ASP Errors

From Hostek.com Wiki
Revision as of 07:11, 22 November 2012 by Chadc (Talk | contribs) (Created page with "==Assembly does not allow partially trusted callers== Problem: You receive the following error when your application attempts to use method, class, etc. from a DLL assembly i...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Assembly does not allow partially trusted callers

Problem: You receive the following error when your application attempts to use method, class, etc. from a DLL assembly in your /bin folder -

"SecurityException: That assembly does not allow partially trusted callers


Cause: We run .Net 2.0/3.5 with a modified medium trust policy for security. This requires that assemblies must specify that they allow partially trusted callers to be called from your code."


Solution -

You must add an assembly directive to your application so that it allows partially trusted callers.

If you are using C#.Net, the following line must be added to your assembly(generally in the AssemblyInfo.cs file) -

[assembly:System.Security.AllowPartiallyTrustedCallers]


If you are using VB.Net, the following line must be added to your assembly(generally in the AssemblyInfo.vb file) -

Assembly: AllowPartiallyTrustedCallers() Surrounded by "<>" without quotes.


Once the directive has been added, you will need to recompile the DLL and upload it to your /bin folder.