Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Mar 19, 2012 01:26 PM by jsn1
Mar 16, 2012 06:26 PM|LINK
I am currently testing a web form to upload documents to a specific folder on a server in the network following this sample
When I run the ASP.Net application using the FileUpload to copy a file located in my local workstation and saving it in my local C:\ drive everything works fine.
But when I run the same application and try to FileUpload the same file to a location in a server in another machine I get the following error message:
“Access \\server\\folder\\file.txt to the path denied.”
The app and the server are in different machines.
FileUpload1.SaveAs("\\server\\shares\\folder\\" & _
My guess is that it is a very common problem related to permissions with IIS, but I do not know how to solve it
Mar 16, 2012 06:27 PM|LINK
The folder on the server has to give write permissions to the Network Service user account or it will never work. Also make sure that the aspnet user has write permissions to the folder too :)
Mar 16, 2012 06:28 PM|LINK
What is the "Network Service user account "? How can I find it?
My account belongs to an active directory group, and I can copy files using Windows Explorer to the server from my workstation.
Is there another account used by IIS?
Mar 16, 2012 06:32 PM|LINK
This would be a local account on the web server itself. Right click the folder, click Properties. Go to Permissions and look at the list of users there. Make sure the Network Service user is listed there. If not, add it and give it write permissions.
Mar 16, 2012 06:37 PM|LINK
I just checked, there are the following accounts:
Also The IIS is installed in my workstation, and the folder where files are copied is located in a server in another computer.
How can I find the Network Service user ?
If it is local account on the web server itself, how can I authorize my network account to write on the folder on the server?
Mar 16, 2012 06:40 PM|LINK
Ok, on the IIS Server where you are putting these files, you perform this same thing but instead click Add, specify the machine, not the AD, then find it in the list of users. heres' a link to help you do that:
Mar 16, 2012 06:41 PM|LINK
Go through steps 1 - 5 but don't forget to add Write. I know its referring to Reporing Services but the concept is still the same.
Mar 16, 2012 08:19 PM|LINK
I tried the Nework Account and even changing Everyone to full control it does not work.
Any other ideas?
Mar 16, 2012 08:21 PM|LINK
You mentioned that "The app and the server are in different machines. FileUpload1.SaveAs("\\server\\shares\\folder\\" & _
Did you make sure network service has permissions on the folder you are saving to? You might have to configure the path as a web folder since its possible that shared folder has NT permissions on it. You might also want to try using impersonation for this
Mar 16, 2012 09:44 PM|LINK
Yes for testing purposes the web applicaiton and the IIS are in my workstation and the folder to upload the files is on another computer a server.
When the application will be deployed to production the applicaiton will be on a server and the data stored on another server.
To your question Did you make sure network service has permissions on the folder you are saving to? I am able to copy a file with windows explorer from my workstation to the server, so my account can write on the server.