繁体   English   中英

ASP.Net文件uploade有错误“访问被拒绝”

[英]ASP.Net file uploade has error “ Access Denied”

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

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

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

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.

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM