Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.net Getting the error "Access to the path is denied." while trying to upload files to my Windows Server 2008 R2 Web server

I have an asp.net webapplication that uploads files to a specific folder on the Web server. locally everything works fine, but when I deploy the application to the Webserver, I begin getting the error "Access to the path "D:\Attachments\myfile.doc" is denied". I gave the "IIS AppPool" user that the application is running under full permission on the folder. I even gave "Everyone" full permissions, but with the same error.

I added the folder to the Exceptions list of the Antivirus, but with the same result. I am begining to suspect that maybe Windows Server 2008 R2 needs a trick for my upload to work. I really appreciate your help.

Thanks

like image 528
Hassan Mokdad Avatar asked Nov 01 '13 09:11

Hassan Mokdad


People also ask

Why is access to the path denied?

You are trying to save to a file that has the same name as the directory. That cannot work, you can't overwrite a directory filled with files with a single new file. That would cause undiagnosable data loss, "Access to the path is denied" is the file system fighting back to prevent that from happening.


1 Answers

Right click on your folder on your server or local machine and give full permissions to

IIS_IUSRS

that's it.

like image 102
UMAR-MOBITSOLUTIONS Avatar answered Oct 27 '22 00:10

UMAR-MOBITSOLUTIONS