We were using itextsharp for pdf generation on the fly in a .net web application. Everything was working fine in our local server. But when we uploaded to the production server, we got an exception with the following details:
Exception Details: System.Security.SecurityException: That assembly does not allow partially trusted callers.
After searching we found that itextsharp dll is compiled to run in full trust. So we found the following solution.
We think it will be helpful for people deploying applications using itextsharp in hosted environments (like godaddy in our case):
1. You should download the source code for itextsharp.
2. Then you have to modify the AssemblyInfo.cs file by adding these references and attribute:
using System.Security;
using System.Security.Permissions;
[assembly: AllowPartiallyTrustedCallers]
3. You should recompile itextsharp and copy again in your bin directory (depending on the way you use it).
5 Responses to “itextsharp: That assembly does not allow partially trusted callers”
tsanko
1 year ago
Wonderful ..thanks a lot for posting a good informitive blog
Panos
1 year ago
Found it interesting
Jorge
1 year ago
How can I re-copile itexshar?
Thank you
point
1 year ago
@Jorge: You should download the source code for itextsharp, open it with visual studio and compile it
Pedrero
1 month ago
Thanks man, works like a charm =D