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