简体   繁体   中英

Access to the path is denied

I'm trying to use a ASP.NET(C#) application on a IIS-Server. Everything is working great, i have only one problem. I'm trying to create a CSV-File in the 'C:\\inetpub\\wwwroot\\bin' directory, but i get the errormessage "Access to the path 'C:\\inetpub\\wwwroot\\bin' is denied.".

I tried to give the 'IUSR' and the 'NT-AUTHORITY/networkservice' all rights, but it still doesn't work. I also tried it in an other directory but also doesn't work.

OS: Windows Server 2008 R2

Thanks in advance!

Edit: Thx! Works now.

use the App_Data folder for that, NOT the bin folder:

more here: http://msdn.microsoft.com/en-us/library/t990ks23.aspx

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

Try adding the rights to the ASPNET user, that might be the issue.
Also, writing a file at the root of the web-folder, is basically a bad idea.

It's much safer if you put create the files in a folder that is not accessible from the web, and than use a separate page to download the file (I'm guessing that's what you are trying to accomplish), something along these lines .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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