0

我在我的网站中使用 ASP.Net 4.5 和身份验证,并且我有一个仅用于管理员的管理文件夹,但是当管理员登录并且我想上传图像时,页面错误是:

Access to the path 'C:\Inetpub\...\secdescimg\65ed367d-9526-4b14-842c-4e10c2845d03.jpg' is denied.  

“secdescimg”这个文件夹不在admin文件夹中,uploade是用户控制的,我通过拖动将两者都移到了admin文件夹,但再次出现此错误。

4

1 回答 1

2

Right-Click the folder, go to Properties, Security tab, make sure the local ASPNET account has Read and Write permissions on that folder. If not, Add local ASPNET account to the list and give it read and write permissions. Click OK.

更新:

It's beacause the problem is that ASPNET user or NETWORK SERVICE user (both are user accounts on the server, which ASPNET uses to authorize for the OS) need to have permissions to write the file to aforementioned location.

Account need the permissions to the folder where file is written (the file isn't there before uploading, of course), so user of course doesn't set any permissions to anywhere but server admninistrator does to 'D:\inetpub\mywebfolder\subfoldername dir in this case (I might suggest specifying a location outside web folders in case they are not supposed to be downloaded just like that)

Writing something is stronger permission than just reading so, admin needs to give the write permission in order to enable file uploading if you want to save it straight to server's hard disk.

于 2013-09-23T09:24:41.640 回答