ASP.NET Trust Level

Asked

Viewed 7,469 times

2

Personal Locaweb made an update on its servers and a site of a client of mine started to present the following error:

System.Security.Securityexception: Request for the permission of type 'System.Security.Permission...

They suggested that I change the Trust Level to FULL. I went to do it on the web.config like this:

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

Ai the site started to present the following error:This configuration section cannot be used at this path. This happens when the site administrator has locked access to this section using <location allowOverride="false"> from an inherited configuration file.

How I solve this I do not know much about ASP.NET.

This is the website code.config.

<configuration>  <system.web>
<trust level="Full" />
<httpRuntime executionTimeout="240" maxRequestLength="100000" requestValidationMode="2.0" />
<!--<httpHandlers>
  <add verb="GET" path="CaptchaImage.axd" type="MSCaptcha.captchaImageHandler, MSCaptcha" />
</httpHandlers>-->
<compilation debug="true" strict="false" explicit="true" targetFramework="4.0">
  <assemblies>
    <add assembly="System.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
    <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
    <add assembly="System.Data.Entity.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
    <add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
    <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
  </assemblies>
  <buildProviders>
    <add extension=".edmx" type="System.Data.Entity.Design.AspNet.EntityDesignerBuildProvider" />
  </buildProviders>
</compilation>
<authorization>
  <allow users="?" />
</authorization>
<roleManager enabled="true" />
<authentication mode="Forms">
  <forms loginUrl="~/administracao/login.aspx" name="frm_login" protection="All" timeout="2880" path="~/administracao" defaultUrl="~/administracao/default.aspx" />
</authentication>
<customErrors mode="Off" />
</system.web>  
<location path="administracao">
<system.web>
  <authorization>
    <allow roles="administradores" />
    <!--<deny users="*"/>-->
    <allow users="?" />
  </authorization>
</system.web>

  • I think if they set in a .config higher than the config cannot be overwritten (allowOverride="false") there will be no way, you will have to ask for their support allow this change (allowOverride="true")

  • What version of Windows Server?

  • @Ciganomorrisonmendez version is Windows 2008 - Enterprise.

3 answers

2


As you have seen it is not possible to change the web.config because the Locaweb does not allow, so this simple solution does not work.

Check the version of DLL Mysql that you are using, because the problem is that the new versions do not work with the trust level medium, so I put in an older version and it worked.

I was using the version 6.7.4 and put the 6.1.2 and stopped giving trouble.

  • Downgrading libraries is not a good solution, it is at most a workaround. Your application certainly lost cool bug or performance gain due to downgrade.

1

According to Locaweb Wiki, the setting can be at most for Medium Trust:

<configuration>
   <system.web> 
      <trust level="Medium" /> 
      ...
   </system.web>
   ...
</configuration>
  • I tried Medium’s also the same mistake. I’ve already opened a call on Locaweb to see if it’s forbidden to make the level change, as Marcus Vinicius mentioned above.

-2

Recently I discovered that to use the file . mdf provided by microsoft has to be trust level full, which Ocaweb ends up preventing the use of it.

And the way is to change hosting. I’m having a headache because of this.

Here is a comment below:

To use an . mdf file you need to have the Full trust level (See here for Details, in the Entity Framework and Universal Providers Section).

Your hosting Provider does not allow you to change the trust level, so having the Directive causes the original error.

Removing the Directive the original error is resolved but then you get a security Exception Since your web application still requires the Full trust level to run, which your hosting Provider does not provide.

  • Hello Arnaldo Junior, welcome to Stackoverflowpt! Consider making comments in the right places! Your comment has been posted as a response! To post a comment, look for a "comment" link below the questions and answers.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.