Monday, March 12, 2012

WebClient DownloadFile problem

I recieve the following error when attempting to download a file from our
web server to be placed on our hard drive. Any clues as to why I would get
this error? By the way, the directory already exists on the hard drive
("c").

System.Net.WebException: An exception occurred during a WebClient
request. --> System.IO.DirectoryNotFoundException: Could not find a part of
the path "C:\Essex\Download\POLEXPT1.DT1".
at System.IO.__Error.WinIOError(Int32 errorCode, String str)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
access, FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath,
Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
access)
at System.Net.WebClient.DownloadFile(String address, String fileName)
-- End of inner exception stack trace --
at System.Net.WebClient.DownloadFile(String address, String fileName)
at EssexWebClient.Download.DownLoadFile(Int32 intFile)Can you show us the code that is generating the error?

>--Original Message--
>I recieve the following error when attempting to download
a file from our
>web server to be placed on our hard drive. Any clues as
to why I would get
>this error? By the way, the directory already exists on
the hard drive
>("c").
>System.Net.WebException: An exception occurred during a
WebClient
>request. --> System.IO.DirectoryNotFoundException: Could
not find a part of
>the path "C:\Essex\Download\POLEXPT1.DT1".
> at System.IO.__Error.WinIOError(Int32 errorCode,
String str)
> at System.IO.FileStream..ctor(String path, FileMode
mode, FileAccess
>access, FileShare share, Int32 bufferSize, Boolean
useAsync, String msgPath,
>Boolean bFromProxy)
> at System.IO.FileStream..ctor(String path, FileMode
mode, FileAccess
>access)
> at System.Net.WebClient.DownloadFile(String address,
String fileName)
> -- End of inner exception stack trace --
> at System.Net.WebClient.DownloadFile(String address,
String fileName)
> at EssexWebClient.Download.DownLoadFile(Int32 intFile)
>
>.

0 comments:

Post a Comment