user1992760
user1992760

Reputation: 31

Getting "System.Security.SecurityException: That assembly does not allow partially trusted callers" when published on shared server

I have a asp.net website uploaded on shared hosting server but for some pages I am getting "SecurityException". This page has no html body, only the code written in page_load event of this page. The reason behind removal of html body was like this page will act as an api so that 3rd party will create a webrequest and will get the appropriate response from the page. On localhost it works fine, but when uploaded the above error occurs. I have used many 3rd party dlls which are required for systematic flow of the project.

Exception details: Small description: System.Security.SecurityException: That assembly does not allow partially trusted callers.

Detailed description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

I also tried doing trust level full in web.config file, but did not worked.

Upvotes: 3

Views: 1646

Answers (1)

Robotronic
Robotronic

Reputation: 472

I had a similar problem.

It was solved via the following configuration -

<system.web>
<trust level="Full" />

Be careful to use uppercase F for Full. Lowercase f generates the following error (which cost me a few hours) -

"Unable to read the security policy file for trust level 'full'."

Upvotes: 4

Related Questions