Report Viewer 10 / "Not a trusted assembly" error
Hi We updated our application to VS2010 / .NET 4.0. We are using the WinForms Report Viewer control to display .rdlc files. Some of the files reference framework DLLs (System.Core, System.Drawing, System.Xml) *If* I use the deprecated methods, everything works. Set the CAS policy to legacy in the app.config: <NetFx40_LegacySecurityPolicy enabled="true" /> Trust the assembly: _reportViewer.LocalReport.AddTrustedCodeModuleInCurrentAppDomain("System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"); HOWEVER: I would like to not depend on the deprecated method. If I do this, instead: PermissionSet permissions = new PermissionSet(PermissionState.None); permissions.AddPermission(new FileIOPermission(PermissionState.Unrestricted)); permissions.AddPermission(new SecurityPermission(SecurityPermissionFlag.Execution)); _reportViewer.LocalReport.SetBasePermissionsForSandboxAppDomain(permissions); Assembly asmSystemDrawing = Assembly.Load("System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"); AssemblyName asmNameSystemDrawing = asmSystemDrawing.GetName(); _reportViewer.LocalReport.AddFullTrustModuleInSandboxAppDomain(new StrongName(new StrongNamePublicKeyBlob(asmNameSystemDrawing.GetPublicKeyToken()), asmNameSystemDrawing.Name, asmNameSystemDrawing.Version)); I get the following error: The report references the code module "System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", which is not a trusted assembly Any advice on this issue? Thanks in advance, Richard
October 28th, 2010 3:23pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics