簡體   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