Data Cogs Information Technology

posts - 137, comments - 144, trackbacks - 42

This is probably something I should have come across before, but this had me stumped for a while today.  I was trying to load a .NET class library (DLL) from a windows exe that ran in the Local Intranet zone.  Any code that attempted to load the DLL failed with “System.Security.SecurityException Security error”.  Problem was that by default a DLL cannot be called from a .NET assembly the is partially trusted (i.e. does not have Full Trust).

You have to make your DLL “opt in” to partially trusted assemblies by adding the AllowPartiallyTrustedCallers (APTCA) assembly attribute!

Like so:

[assembly:System.Security.AllowPartiallyTrustedCallers]        // C# syntax

More info here.

 

posted on Tuesday, October 18, 2005 6:56 PM

Feedback

# re: AllowPartiallyTrustedCallers

Hello all
5/14/2007 11:40 PM | auto insurance

# re: AllowPartiallyTrustedCallers

Another way to bypass this road block is to go to the projects properties. Browse to the security tab. It should show clickonce information. Enable it and then it'll allow you to specify Full Trust. This will avoid any coding if you so choose.
2/14/2009 4:58 AM | Rajib Bahar

Post Comment

Title  
Name  
Url
Comment   
Protected by Clearscreen.SharpHIPEnter the code you see: