views:

25

answers:

0

hi there,

I try to download a file from a website. I do have access from browser and I don't get error by reading I think. The error is that the TO folder is "access denied."

I JUST WANT TO COPY THE FILE from REMOTE website TO our LOCAL Folder...

This is Windows Service project... NOT Winforms or NOT ASPWEB project..

string from = "http://thewebsite.com/files/a_lux/WS_Import_Result_2.xml";

//string to = \\192.144.3.200\w$\webs\ABC\DownloadXML\Results<--- original folder

sting to = "c:\\temp;

System.Net.WebClient webclient = new System.Net.WebClient();
webclient.DownloadFile(new Uri(from).AbsoluteUri, to);

I get this error: {"Access to the path 'c:\\temp' is denied."}

I gave Networkservice, aspn.net, everyone -> full permission in folder/properties/security to this folder... I still get this error....

since this is a Windows Service project (Batch running) My app.config is empty.... just the connectionstring is in here.

What could be the problem?

thanks

mesut

System.Net.WebException was caught
  Message="An exception occurred during a WebClient request."
  Source="System"
  StackTrace:
       at System.Net.WebClient.DownloadFile(Uri address, String fileName)
       at System.Net.WebClient.DownloadFile(String address, String fileName)
       at WindowsService_Addemar.Program.Main() in C:\Users\dte\Documents\Visual Studio 2008\Projects\WindowsService_abc\WindowsService_Aabc\Program.cs:line 132
  InnerException: System.UnauthorizedAccessException
       Message="Access to the path 'c:\\temp' is denied."
       Source="mscorlib"
       StackTrace:
            at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
            at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
            at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
            at System.Net.WebClient.DownloadFile(Uri address, String fileName)
       InnerException: