1

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\imagedepot to be a mapdrive of Z:\ i get.

Could not find a part of the path 'Z:\AT294577469.jpeg'

Any ideas?

abatishchev
  • 92,232
  • 78
  • 284
  • 421

1 Answers1

1

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

Community
  • 1
  • 1
Yahia
  • 67,016
  • 7
  • 102
  • 131
  • see thats the thing, i was using this just fine for like a month, i just switched it over to new install of winsows 2008 –  Jul 30 '11 at 14:08
  • its a console app, an permissions for that folder is everyone,full. which makes no sense, because like i said I can create a file manually using either of those paths. –  Jul 30 '11 at 14:16
  • does the console app run with the same user as when you try it manually ? – Yahia Jul 30 '11 at 14:18
  • umm i'm not sure, i dont specify a user, but again that folder permisisons is Everyone and full. everyone doesnt need a user. –  Jul 30 '11 at 14:22
  • I am NOT talking about the persmissions of the folder/share... BUT I am talking about the persmission/rights/user your console app is running under... – Yahia Jul 30 '11 at 14:23
  • oh yes, the console app does use the same user. –  Jul 30 '11 at 14:31
  • then there is something weird going on with your OS installation... can you write to the share from within the console app using some other method (not WebClient) ? – Yahia Jul 30 '11 at 14:33
  • Yeah i can use File.appendalltext to create a text file and it goes straight to Z:\ –  Jul 30 '11 at 14:47
  • then I am out of ideas... sorry – Yahia Jul 30 '11 at 14:50
  • hmm interesting, i put that code in directly above the line and it cant find that path. I was trying that outside in a test code. So yeah, it's a windows service console app and it cant find path –  Jul 30 '11 at 14:56
  • thanks for the help, but i really have been used that same exact code for like a month, my guess is this new install of winsows 2008 something must have been configured differently. –  Jul 30 '11 at 15:01