Getting "System.Security.SecurityException: This assembly does not allow partially trusted subscribers" when publishing to a shared server

I have an asp.net site uploaded to a shared hosting server but for some pages I am getting a "SecurityException". There is no html body on this page, just the code written in page_load on this page. The reason for removing the html body was so that this page would act as an api so that the third party would create a web request and receive a corresponding response from the page. On localhost it works fine, but above error occurs when booting. I have used many third party libraries that are necessary to keep the project flowing systematically.

Exception Details: Minor Description : System.Security.SecurityException: This assembly does not allow partial trust of callers.

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

I also tried to make the trust level complete in the web.config but didn't work.

+3


source to share


1 answer


I had a similar problem.

It was solved through the following configuration -

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

      



Be careful with the uppercase F for Full. Lowercase f generates the following error (which cost me several hours) -

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

+4


source







All Articles