Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

System.Security.SecurityException?

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.

Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

My code runs proper in my local server it's create issue when upload it to server.

Have gone through following code but it's not working for me :

Sample 1 :

<system.web>
  <securityPolicy>
    <trustLevel name="Full" policyFile="internal"/>
  </securityPolicy>
</system.web>

Sample 2 :

<location allowOverride="false">
  <system.web>
    <securityPolicy>
      <trustLevel name="Full" policyFile="internal" />
      <trustLevel name="High" policyFile="web_hightrust.config" />
      <trustLevel name="Medium" policyFile="web_mediumtrust.config" />
      <trustLevel name="Low"  policyFile="web_lowtrust.config" />
      <trustLevel name="Minimal" policyFile="web_minimaltrust.config"/>
    </securityPolicy>
  </system.web>
</location>

Sample 3 :

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

I can't able to access IIS I have only FTP details to upload file. Please suggest me option to solve it from webconfig file.

like image 912
Yashwant Kumar Sahu Avatar asked Jul 17 '12 14:07

Yashwant Kumar Sahu


1 Answers

The approach you used in sample three is similar to my solution, but I did not add the additional attribute that you had. Try this simple approach.

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

This came from an MSDN posting I read.

like image 67
ZaneDarken Avatar answered Nov 06 '22 07:11

ZaneDarken