asp.net FileUpload control problem: access to directory is denied

久未见 提交于 2019-12-08 03:17:22

问题


Im trying to use the fileupload control. Im using Visual Web Developer Express on my desktop.

My web application is working fine except I cant use the fileUpload control. I get the following error:

ERROR: Access to the path (My_Directory) is denied

I searched and it appears to be a permissions problem. So I attempted to add the user ASPNET and give appropriate permissions to the directory, however, I was unable to add user "ASPNET". User "ASPNET" was not found.

So then I followed the following directions to add user ASPNET via Control Panel > Administration > Computer management. So now I was able to add user ASPNET to the directory and give appropriate permissions but I still got the above error.

http://p2p.wrox.com/net-web-services/5918-creating-aspnet-user.html

Any ideas on why I cant access the directory?


回答1:


If you're using Vista/Windows 7/Win2003/Win2008, the user you need is the Network Service account. You can verify by seeing what user your application pool is running under.

Grant the proper permissions to that account (if indeed it's the account that your application pool is running under) and you'll be golden. Note also that with Windows 7 and Win2008, the default account could be the ApplicationPoolIdentity, which you can find out more information about at http://forums.iis.net/t/1156692.aspx. Regardless, you can simply switch the account that your application pool is running under to the Network Service account to verify that that is the issue.




回答2:


Ever figure this out? If you're overwriting files check to make sure they aren't set to read-only.

I've handled these permissions plenty before and had tried everything in the book and on this site and others (I'm on Win7, IIS7.5 also). Sometimes it's the silly little things...



来源:https://stackoverflow.com/questions/2863066/asp-net-fileupload-control-problem-access-to-directory-is-denied

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!