OddiC
asked on
CAS, .NET, and Assembly Calling Permissions... Why won't my permission.Assert() take?
I kept getting a SqlClientPermission error from a custom .NET component I built that calls a local database on my test server. After some research, I decided to use a SqlClientPermission object (code below), however, that has not resolved the issue.
Now (with the code below trying to grant my code Unrestricted access), I get the error:
"Request for the permission of type 'System.Security.Permissio ns.Securit yPermissio n, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c56193 4e089' failed."
All of my Zones are configured for Full Trust (via the 2.0 Framework Configuration Tool). I cannot figure out what the issue is. Any and all suggestion, references, and help are very greatly appreciated. There has got to be a way to fix this... but I can't see it!!! :)
Thanks a ton in advance.
Now (with the code below trying to grant my code Unrestricted access), I get the error:
"Request for the permission of type 'System.Security.Permissio
All of my Zones are configured for Full Trust (via the 2.0 Framework Configuration Tool). I cannot figure out what the issue is. Any and all suggestion, references, and help are very greatly appreciated. There has got to be a way to fix this... but I can't see it!!! :)
Thanks a ton in advance.
SqlClientPermission permission = new SqlClientPermission(PermissionState.Unrestricted);
permission.Assert();
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for the tip- but I had already tried adjusting CAS policies and zone trust settings to no avail.. ugh! Luckily, I found a *temporary* solution. I edited the rsservpolicy.config file, added a Full Trust (local) permission policy, and applied that policy to all of SSRS.
Obviously this is a security hazard and not the ideal solution.
Does anyone out there know how I could set similar security to allow my custom component (located in the SSRS Repert Server bin folder) to work?
All help is very much appreciated!
Obviously this is a security hazard and not the ideal solution.
Does anyone out there know how I could set similar security to allow my custom component (located in the SSRS Repert Server bin folder) to work?
All help is very much appreciated!
ASKER
My component is being called from from an SSRS Report (it fails in ReportViewer control, ReportServer, and ReportManager interfaces/tools). It's being called from the <Code> section (the .dll is referenced by the report RDL).
Also, here is the full SqlClient Exception I got ((names omitted for anonymity)):
System.Security.SecurityEx
at System.Security.CodeAccess
at System.Security.Permission
at System.Data.Common.DbConne
at System.Data.SqlClient.SqlC
at System.Data.SqlClient.SqlC
at System.Data.ProviderBase.D
at System.Data.SqlClient.SqlC
at MyClass.MyMethod.GetData()
The action that failed was:
Demand
The type of the first permission that failed was:
System.Data.SqlClient.SqlC
The Zone of the assembly that failed was:
MyComputer