468,765 Members | 1,068 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,765 developers. It's quick & easy.

Download Error (Web Client)


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
1 3225

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.

Similar topics

4 posts views Thread by - - Pierre | last post: by
6 posts views Thread by Glenn Owens | last post: by
3 posts views Thread by Du Dang | last post: by
reply views Thread by Kelmen Wong | last post: by
6 posts views Thread by Jatin | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.