WebClient.Download() exception: Access to the path
I have a very simply code of:
WebClient webClient = new WebClient();
webClient.DownloadFile(privateHTML, @"\\192.168.0.12\imagedepot\AT" + carID + ".jpeg");
However, i get the error:
Access to the path '\\192.168.0.12\imagedepot\AT296866482.jpeg' is denied.
I can browse this folder from my machine (same one this app runs on), right click and create new text file. The target is a windows 2008 server. Any ideas? That folder share is set to everyone with full.
When I change \192.168.0.12\im开发者_运维知识库agedepot to be a mapdrive of Z:\ i get.
Could not find a part of the path 'Z:\AT294577469.jpeg'
Any ideas?
EDIT after comment:
Then this is perhaps a permissions/rights issue... what sort of application is it ? WinForms ? Windows Service ? ASP.NET ?
EDIT 2:
Now that it is clarified by the OP (see comments) that it is a Windows Service the problem is clear:
Accsessing Network drives/UNC paths from a service is definitely a permissions/rights issue as Service is usually NOT allwed to access a network share and/or a mapped drive!
see Map a network drive to be used by a service
精彩评论