开发者

change the application's trust level in the configuration file

开发者 https://www.devze.com 2022-12-21 15:30 出处:网络
In the below code I am deleting a file from c开发者_StackOverflow中文版lient pc Dim fs fs = Server.CreateObject(\"Scripting.FileSystemObject\")

In the below code I am deleting a file from c开发者_StackOverflow中文版lient pc

Dim fs
fs = Server.CreateObject("Scripting.FileSystemObject")
'If fs.FileExists(upfile.PostedFile.FileName) Then
   fs.DeleteFile(upfile.PostedFile.FileName)
'End If

In the Web.config file, I have configured the trust level also. :

<configuration>
  <system.web>
    <identity impersonate='true'/>
  </system.web>
  <location allowOverride="true">
    <system.web>
      <trust level="Full" originUrl="" />
    </system.web>
  </location>
  ....

BUt while running the application, it is giving the following error. How to change security settings?

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: Exception from HRESULT: 0x800A0046 (CTL_E_PERMISSIONDENIED).


Setting the website's trust level to "full" has no bearing on how script runs on the client browser, it affects how the server runs your site.

Generally, you are not allowed to muck around on a "client PC" in this way, for fairly obvious reasons, and depending on where (and how) this code is running (is it in a client script block or on the server?) will affect the permissions needed.

0

精彩评论

暂无评论...
验证码 换一张
取 消