SecurityException: That assembly does not allow partially trusted callers while using itextsharp dll

29. November 2012

When you are using itextsharp library on a shared web hosting server then you might get this type of error because of .net trust level being set to Medium . 

 

Now in order to resolve this issue you will have to rebuild the original dll source that is itextsharp source with a slight change in AssemblyInfo.cs 

You will have to Insert this Statement in it 

[assembly: System.Security.AllowPartiallyTrustedCallers]

And rebuild the same and reference the new dll and there wont be any error anymore . If you donot have source for itextsharp then you can download from this link - http://sourceforge.net/projects/itextsharp/?source=dlp

If you are not able to resolve this issue then a descriptive explanation is also provided on this blog post - http://www.ben-morris.com/allow-partially-trusted-callers-asp-net-shared-hosting-environments

OR

Click Here 

iTextSharp ,