User36583972 posted
Hi NatarajYashash,
From your description, you can try the following options.
1: Give the library you are trying to call a strong name.
2: Add [assembly:AllowPartiallyTrustedCallers] to the library that you are trying to call.
3: Create a code group to set permissions to the library
Also, there is a possibility that not your assembly is the problem, but you are calling another assembly that does not allow partially trusted callers.
At runtime, you can use fuslogvw to find which assembly is giving you the problems.
Assembly Binding Log Viewer (Fuslogvw.exe):
https://msdn.microsoft.com/en-us/library/e74a18c4(VS.71).aspx
If this is the problem and you have the sources of this assembly you need to also apply the [assembly:AllowPartiallyTrustedCallers] attribute to that assembly.
The following links may be helpful for you.
ASP.Net iTextSharp System.Security.SecurityException: That assembly does not allow partially trusted callers:
http://www.aspsnippets.com/Articles/ASPNet-iTextSharp-SystemSecuritySecurityException-That-assembly-does-not-allow-partially-trusted-callers.aspx
Allow partially trusted callers – using ASP.NET in shared hosting:
http://www.ben-morris.com/allow-partially-trusted-callers-asp-net-shared-hosting-environments/
Best Regards,
Yohann Lu