James Boden
New member
- Joined
- Sep 1, 2010
- Messages
- 1
- Programming Experience
- 5-10
I have a report that is using in the references system.security and calling a code block do decrypt a SSN. The report works fine on the server and locally but when I switch databases and call a different one with out switching the report data defination to the new database I get the error in the report viewer for the local processing that the report references the code module "system.Security, blah, blah", which is not a trusted assembly. I have added to the assemblyinfo.vb the following: <Assembly: AllowPartiallyTrustedCallers()>
I have added to the report viewer module the following:
rptViewer.LocalReport.ExecuteReportInCurrentAppDomain(AppDomain.CurrentDomain.Evidence)
rptViewer.LocalReport.AddTrustedCodeModuleInCurrentAppDomain("System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3aZ")
I have added to the rssrvpolicy.config the follow:
<PermissionSet
class="NamedPermissionSet"
version="1"
Name="TestPermissions">
<IPermission
class="SecurityPermission"
version="1"
Unrestricted="true"
/>
</PermissionSet>
<CodeGroup
class="UnionCodeGroup"
version="1"
PermissionSetName="TestPermissions"
Name="TestCodeGroup"
Description="">
<IMembershipCondition
class="UrlMembershipCondition"
version="1"
Url="C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Security.dll"
/>
</CodeGroup>
The only thing I did not do is the assert and I am not sure where that goes.
If anyone has done this before it would be a great help.
Thanks
I have added to the report viewer module the following:
rptViewer.LocalReport.ExecuteReportInCurrentAppDomain(AppDomain.CurrentDomain.Evidence)
rptViewer.LocalReport.AddTrustedCodeModuleInCurrentAppDomain("System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3aZ")
I have added to the rssrvpolicy.config the follow:
<PermissionSet
class="NamedPermissionSet"
version="1"
Name="TestPermissions">
<IPermission
class="SecurityPermission"
version="1"
Unrestricted="true"
/>
</PermissionSet>
<CodeGroup
class="UnionCodeGroup"
version="1"
PermissionSetName="TestPermissions"
Name="TestCodeGroup"
Description="">
<IMembershipCondition
class="UrlMembershipCondition"
version="1"
Url="C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Security.dll"
/>
</CodeGroup>
The only thing I did not do is the assert and I am not sure where that goes.
If anyone has done this before it would be a great help.
Thanks