Creating directories in medium trust environment?

前端 未结 1 1493
生来不讨喜
生来不讨喜 2021-01-27 16:47

I\'ve got an ASP.NET Web Application running in a medium trust environment with a shared hosting provider. The following code causes a SecurityException to be thrown:



        
相关标签:
1条回答
  • 2021-01-27 17:24

    As long as the path you are trying to access is under the Virtual Directory your application is in, you should be able to access it in Medium Trust. Are you sure your application identity has folder create permission?

    http://msdn.microsoft.com/en-us/library/aa302425#c09618429_015


    Edit: I might have read the doc above wrong. See this link as well, it appears you only have Read, Write, Append, and PathDiscovery permissions :(

    FileIOPermission is restricted. This means you can only access files in your application's virtual directory hierarchy. Your application is granted Read, Write, Append, and PathDiscovery permissions for your application's virtual directory hierarchy.

    http://msdn.microsoft.com/en-us/library/ff648344.aspx

    0 讨论(0)
提交回复
热议问题