Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase «««45678»»»

Centralising Reporting Services Stylesheets Expand / Collapse
Author
Message
Posted Tuesday, May 26, 2009 4:27 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, October 14, 2014 10:51 PM
Points: 191, 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.
Post #723670
Posted Wednesday, May 27, 2009 4:28 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Saturday, December 6, 2014 9:55 AM
Points: 81, Visits: 908
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
Post #723938
Posted Wednesday, May 27, 2009 4:35 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, February 25, 2010 5:15 AM
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
Post #723940
Posted Wednesday, May 27, 2009 6:28 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Saturday, December 6, 2014 9:55 AM
Points: 81, Visits: 908
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
Post #724007
Posted Wednesday, May 27, 2009 11:50 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Thursday, May 15, 2014 3:17 AM
Points: 53, 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 .
Post #724412
Posted Thursday, June 18, 2009 3:32 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Saturday, December 6, 2014 9:55 AM
Points: 81, Visits: 908
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.
Post #737319
Posted Tuesday, July 21, 2009 8:49 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, October 16, 2014 2:23 AM
Points: 5, Visits: 109
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
Post #756659
Posted Thursday, October 29, 2009 4:53 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, September 5, 2013 5:51 AM
Points: 1, Visits: 68
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.
Post #810630
Posted Friday, October 30, 2009 9:56 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Friday, December 12, 2014 5:19 AM
Points: 2,528, Visits: 1,148
Hi all,

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

Are there some good resource who know the solution?

Regards
René
Post #811720
Posted Monday, November 2, 2009 6:30 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Friday, December 12, 2014 5:19 AM
Points: 2,528, Visits: 1,148
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é
Post #812339
« Prev Topic | Next Topic »

Add to briefcase «««45678»»»

Permissions Expand / Collapse