ASP Errors

From Hostek.com Wiki
Revision as of 09:47, 22 November 2012 by Carlb (Talk | contribs)

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.

800a01fb error

Generally, the recordset was not closed properly. Try the following, making the needed changes for your variable names:

if not isObject("objRS") then
set objRS=Server.CreateObject("ADODB.RecordSet")
end if
if objRS.state <> 0 then
objRS.close
end if
objRS.Open strTableNameOrSQL,objConnection