1

I have ASP.Net 4.5 MVC site. I have hosted my site on shared server, but everytime I create subdomain or domain I get the below error

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 am NOT asking here what shoud I do to fix this error,that I know.

But my question is

  • What kind of operations are causing this Trust Level issue?
  • What should I change in my site,so that if trust level is set to medium(other than full), it renders as desired.
Kgn-web
  • 7,047
  • 24
  • 95
  • 161

1 Answers1

0

By default the ASP.NET Trust Level set for websites is a Custom High Level Trust which should be adequate for most ASP.NET websites.

In some circumstances you may find that a higher ASP.NET Trust level is required. If your application requires Full Trust, you can override the trust level at the application level by adding the following to your web.config file.

To place your website in to Full Trust you need to place the code below in to the 'configuration\system.web' section of your website web.config file:-

If your websites web.config file does not have a 'configuration\system.web' section below is an example that includes these sections of the web.config file:-

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

You might refer this link for reason of using different trust level:https://msdn.microsoft.com/en-IN/library/tkscy493(v=vs.85).aspx

Ubiquitous Developers
  • 3,637
  • 6
  • 33
  • 78
  • 1
    mate...if I try to set trust level in web.config,however it will render the site on local server, but on deploying with this config on shared server, I gets an exception.. `This configuration section cannot be used at this path. This happens when the site administrator has locked access to this section using from an inherited configuration file.` – Kgn-web Dec 12 '15 at 18:18
  • you might go through this link then :http://stackoverflow.com/questions/9794985/iis-this-configuration-section-cannot-be-used-at-this-path-configuration-lock – Ubiquitous Developers Dec 12 '15 at 18:23
  • mate my question is what are the operations that require full trust level, by default I have been given medium trust level on shared hosting server.. & even I don't want to set to trust level to full.. so I want to identify what functions/operations are required full trust level – Kgn-web Dec 12 '15 at 18:34
  • you can go through the link, I've attached with the answer. You can check when to use which function – Ubiquitous Developers Dec 12 '15 at 20:22