Groups | Blog | Home
all groups > dotnet security > february 2006 >

dotnet security : Request for Permission failed


Craig
2/16/2006 12:00:00 AM
I have an assembly that I wrote in .NET 2.0 for Reporting Services.

It essentially attaches to an Oracle DB and gets back a dataset.

I tried it out by a test windows application and it worked fine, however
when I try and run it within Reporting Services I get...

System.Security.SecurityException was unhandled by user code
Message="Request for the permission of type
'System.Data.OracleClient.OraclePermission, System.Data.OracleClient,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."
Source="mscorlib"
StackTrace:
at System.Security.CodeAccessSecurityEngine.Check(Object demand,
StackCrawlMark& stackMark, Boolean isPermSet)
at System.Security.PermissionSet.Demand()
at System.Data.Common.DbConnectionOptions.DemandPermission()
at System.Data.OracleClient.OracleConnection.PermissionDemand()
at
System.Data.OracleClient.OracleConnectionFactory.PermissionDemand(DbConnection
outerConnection)
at
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory)
at System.Data.OracleClient.OracleConnection.Open()
at Cambrex.ReportRoutines.GetParameterValue(String sConnection,
String sCompanyCode, String sName, String sDatabase)
at ReportExprHostImpl.textbox22_TextBoxExprHost.get_ValueExpr()
at
Microsoft.ReportingServices.ReportProcessing.ReportRuntime.EvaluateTextBoxValueExpression(TextBox
textBox)

Which has kind of thrown me. My assembly I wrote is Strong Named and in the
GAC. When I check the zone of the exception it is MyComputer which has Full
Trust so I am not too sure whats causing the problem.

Any ideas?

Thanks,

Craig

Narendra
2/16/2006 6:21:27 AM
Hi,
I think it is case of proper authentication/authorization configuration. I
have not worked iwth oracle but following Couple of questions would help you
to understand
1. How do you make database connection? (e.g windows authentication/ SQL
authentication in MS-SQL)
2. Do you use any user name for database connection? if yes, please check,
it has been granted an access.

or you can send code where you are gettting an error.......
regards,
narendra.

[quoted text, click to view]
Craig
2/17/2006 12:00:00 AM
Thanks for the response.

The problem was not to do with the connection but the trust level of the
assembly.

I had to add a CodeGroup element to the RSPreviewPolicy.config of SSRS.
This allowed my assembly to receive trust and could then execute the Oracle
command.

Thanks,

Craig

[quoted text, click to view]

Craig
2/17/2006 12:00:00 AM
Oh one other thing. I also had to Assert the OraclePermission object as
well before I called the open command.

Craig

[quoted text, click to view]

AddThis Social Bookmark Button