By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,650 Members | 1,785 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,650 IT Pros & Developers. It's quick & easy.

Download Error (Web Client)

P: n/a

Hello,
I am trying to download a file and get a current error:

Download(...): Unable to download file

Access to the path 'C:\Temp\aaa.zip' is denied.

While I was downloading with this code:
_webClient = new WebClient();
_webClient.DownloadFile(httpPath, filePath);
Another thing is that I am doing this action for few threads and each
thread creates it's own filePath (but I don't think it's related to it).

How to avoid this error?

Thank you!

*** Sent via Developersdex http://www.developersdex.com ***
Nov 20 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a

Does C:\temp\
already exist?

If not, experiment with making the directory before downloading.

Who is trying to save the file?

Here is some VERY CRAPPY code to identify the "who".

private string FindIIdentity()

{

try

{

//'Dim user As WindowsPrincipal =
CType(System.Threading.Thread.CurrentPrincipal, WindowsPrincipal)

//'Dim ident As IIdentity = user.Identity

string returnValue = string.Empty;

WindowsIdentity ident = WindowsIdentity.GetCurrent();

returnValue = ident.Name;

try

{

returnValue += " on " + System.Environment.MachineName;

}

catch (Exception ex)

{

Conditionals.Trace.WriteMessage(ex.Message);

}

return returnValue;

}

catch (Exception ex)

{

Conditionals.Trace.WriteMessage(ex.Message);

return "Error Finding Identity";

}

}


"csharpula csharp" <cs*******@yahoo.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>
Hello,
I am trying to download a file and get a current error:

Download(...): Unable to download file

Access to the path 'C:\Temp\aaa.zip' is denied.

While I was downloading with this code:
_webClient = new WebClient();
_webClient.DownloadFile(httpPath, filePath);
Another thing is that I am doing this action for few threads and each
thread creates it's own filePath (but I don't think it's related to it).

How to avoid this error?

Thank you!

*** Sent via Developersdex http://www.developersdex.com ***

Nov 20 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.