SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Centralising Reporting Services Stylesheets


Centralising Reporting Services Stylesheets

Author
Message
Sinh Dinh
Sinh Dinh
SSC-Enthusiastic
SSC-Enthusiastic (197 reputation)SSC-Enthusiastic (197 reputation)SSC-Enthusiastic (197 reputation)SSC-Enthusiastic (197 reputation)SSC-Enthusiastic (197 reputation)SSC-Enthusiastic (197 reputation)SSC-Enthusiastic (197 reputation)SSC-Enthusiastic (197 reputation)

Group: General Forum Members
Points: 197 Visits: 566
I created a dll using C#. I'm getting this "warning":

Warning 2 [rsRuntimeErrorInExpression] The Value expression for the textrun ‘Textbox4.Paragraphs[0].TextRuns[0]’ contains an error: Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. C:\Documents and Settings\... 0 0



Here's the expression: =RSStyleLibrary.RSStyleSheet.ReportStyleGet("Color", "Accounting", "Header")

Class file code

using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Collections;

namespace RSStyleLibrary
{
public class RSStyleSheet
{
public static string ReportStyleGet(string StyleType, string StyleFamily, string StyleCategory)
{
//StyleType = "Color";
//StyleFamily = "Accounting";
//StyleCategory = "Header";
string RetVal;

SqlConnection conn = new
SqlConnection("server;database;User ID;Password);

SqlCommand USP_ReportStyleGet = new SqlCommand("USP_ReportStyleGet", conn);
USP_ReportStyleGet.CommandType = CommandType.StoredProcedure;

USP_ReportStyleGet.Parameters.AddWithValue("@StyleType", StyleType);
USP_ReportStyleGet.Parameters.AddWithValue("@StyleFamily", StyleFamily);
USP_ReportStyleGet.Parameters.AddWithValue("@StyleCategory", StyleCategory);

conn.Open();
RetVal = USP_ReportStyleGet.ExecuteScalar().ToString();
conn.Close();

return (string)RetVal;

}

}
}



Any help would be greatly appreciated.
Adam Aspin
Adam Aspin
SSC-Addicted
SSC-Addicted (457 reputation)SSC-Addicted (457 reputation)SSC-Addicted (457 reputation)SSC-Addicted (457 reputation)SSC-Addicted (457 reputation)SSC-Addicted (457 reputation)SSC-Addicted (457 reputation)SSC-Addicted (457 reputation)

Group: General Forum Members
Points: 457 Visits: 1032
Hi Sinh,

I have no idea off the top of my head about this one. I will have to spend some time looking at the deeper security implications of this process - but finding the time at the moment is difficult.

Did you try signing the assembly using a strong key file?

Regards,

Aam
sbygrave
sbygrave
Forum Newbie
Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: General Forum Members
Points: 4 Visits: 35
Hi Sinn

I have no idea about C# but when I did this in vb.net I had to play with security issues:
Dim oPerm As New Data.SqlClient.SqlClientPermission(System.Security.Permissions.PermissionState.Unrestricted)
oPerm.Assert()


May be worth you checking this out?

Cheers
Steve
Adam Aspin
Adam Aspin
SSC-Addicted
SSC-Addicted (457 reputation)SSC-Addicted (457 reputation)SSC-Addicted (457 reputation)SSC-Addicted (457 reputation)SSC-Addicted (457 reputation)SSC-Addicted (457 reputation)SSC-Addicted (457 reputation)SSC-Addicted (457 reputation)

Group: General Forum Members
Points: 457 Visits: 1032
Hi Steve & Sinh,

You could need to look at:

adding a code group to the rssrvpolicy.config - http://support.microsoft.com/kb/842419 (explains this particular error)

or:
http://msdn.microsoft.com/en-us/library/ms154466(SQL.90).aspx

- for an overview of custom assembly security.

Let us all know what exactly you have to do!

Regards,

Adam
aveerabadran
aveerabadran
SSC-Enthusiastic
SSC-Enthusiastic (109 reputation)SSC-Enthusiastic (109 reputation)SSC-Enthusiastic (109 reputation)SSC-Enthusiastic (109 reputation)SSC-Enthusiastic (109 reputation)SSC-Enthusiastic (109 reputation)SSC-Enthusiastic (109 reputation)SSC-Enthusiastic (109 reputation)

Group: General Forum Members
Points: 109 Visits: 291
But i face a strange problem.

In SQLServer 2005 environment (enterprise&standard edition) when i use this DLL ,
the solution works gr8 if we preview the report using BIS. But if we deploy the report and view via report manager, the report comes up , but WITHOUT applying the style.

i have placed the DLL in the locations mentioned in the article... but no luck

Any ideas?

Thanks,
Arunvijay

PS : Please ignore my previous post , where i have told that this solution works in enterprise edition , but doesnt work in standard edition .
Adam Aspin
Adam Aspin
SSC-Addicted
SSC-Addicted (457 reputation)SSC-Addicted (457 reputation)SSC-Addicted (457 reputation)SSC-Addicted (457 reputation)SSC-Addicted (457 reputation)SSC-Addicted (457 reputation)SSC-Addicted (457 reputation)SSC-Addicted (457 reputation)

Group: General Forum Members
Points: 457 Visits: 1032
OOPs- My apologies to all who hit permissions problems, you need to add something like:

"CodeGroup class="UnionCodeGroup"
version="1"
PermissionSetName="FullTrust"
Name="MyCodeGroup"
Description="Code group for my data processing extension">
version="1"
Url="C:\pathtocustomassembly\fixedstylelibrary.dll"
/>
"



To the rssrvpolicy.config file (probably in Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer\)

This is adapted from : http://support.microsoft.com/kb/920769

Where you can find more details.
mds1966@googlemail.com
mds1966@googlemail.com
Forum Newbie
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: General Forum Members
Points: 5 Visits: 120
Hi.

Did you ever get this to work? I am pulling my hair out changing the various policy configuration files adding 'Code Groups' and 'Permissions Sets'. I've followed the MS Knowledge base articles and spends 2 days trawling various resource trying to find the magic that will make this work, but right now its a big NO NO.

What probably worse is I don't actually get any errors. Deployed report runs fine. I just don't get any of my db defined styles. As many other people on here have said, it all works beautifully in BIDS preview mode.

Any light you could shed on this would be great.

Martin
ed.godshaw
ed.godshaw
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
Points: 1 Visits: 69
Just a word of advice (after two days of trial and error!) you need to edit C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\RSPreviewPolicy.config to grant the assembly the correct security permisions in order to get the code in the tutorial to work correctly.

Just add in a new code group with the url of your custom assembly and give it 'FullTrust' permissions. The System.Security.Permissions failed error.
rene-500237
rene-500237
SSCrazy
SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)

Group: General Forum Members
Points: 2657 Visits: 1186
Hi all,

I do have the same problem with the security of the dll in ReportServer. Crazy

Are there some good resource who know the solution?

Regards
René
rene-500237
rene-500237
SSCrazy
SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)

Group: General Forum Members
Points: 2657 Visits: 1186
:-D Hi all,

I could fix my permission problem. I add the following code to the assembly:

Imports System.Security.Permissions

Public Class DataDrivenStyleLibrary
Public Shared Function dbStyle(ByVal inputStyle As String, ByVal InputStyleType As String) As String
Dim permission As SqlClientPermission = New SqlClientPermission(PermissionState.Unrestricted)
permission.Assert()
sStyle = ""



I found the trick here http://softwareexpertsolutions.blogspot.com/2007/06/creating-and-deploying-reporting.html

I added in rssrvpolicy.config my code group like:

<CodeGroup class="UnionCodeGroup"
version="1"
PermissionSetName="FullTrust"
Name="DynamicStyleLibrary"
Description="Dynamic Reports">
<IMembershipCondition
class="UrlMembershipCondition"
version="1"
Url="C:\Program Files\Microsoft SQL Server\MSSQL.X\Reporting Services\ReportServer\bin\DynamicStyleLibrary.dll"/>
</CodeGroup>



I restarted IIS & RS .

I hope this will solve the other issue as well.

Many thanks for this great blog.

Regards,
René
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search