Search code examples
asp.netsecurityitextrackspace

How to run Itextsharp.dll in Medium Trust at on Rackspace Cloud Sites


I am getting security exception while using itextsharp.dll in rackspace cloud site. Following is the exception:

[SecurityException: That assembly does not allow partially trusted callers.]

Can anyone help on this?


Solution

  • To ensure that your assemblies will work in a medium trusted environment, you need to give them a strong name and mark them with an attribute that tells the .NET security runtime to allow the code.

    To allow partially trusted callers from your code, add the following attribute to the assembly’s AssemblyInfo.cs file:

    [assembly: AllowPartiallyTrustedCallers]
    

    You will also need to ensure that the file references the System.Security namespace.

    In addition, you will also need to give your assembly a strong name by signing the assembly though the project properties dialog.