RE: WebClient and File Download
- From: wawang@xxxxxxxxxxxxxxxxxxxx (Walter Wang [MSFT])
- Date: Thu, 26 Jul 2007 09:18:43 GMT
Hi,
Do you mean that directly calling
WebClient.DownloadFileAsync("http://www.sample.com/mydir/myfile.csv",
"c:\1.csv") will fail with 404?
That's strange if the URL really exists. Please try if following code works
on your side:
Imports System.Net
Imports System.ComponentModel
Module Module1
Sub Main()
Dim wc As New WebClient()
AddHandler wc.DownloadFileCompleted, AddressOf
wc_DownloadFileCompleted
wc.DownloadFileAsync(New
Uri("http://msdn2.microsoft.com/default.aspx"), "c:\temp\1.txt")
Console.Read()
End Sub
Sub wc_DownloadFileCompleted(ByVal sender As Object, ByVal e As
AsyncCompletedEventArgs)
Console.WriteLine("Done")
End Sub
End Module
As you can see, the code is simple. If the URL exists and you're actually
able to download the root document, I don't see why it fails.
Regards,
Walter Wang (wawang@xxxxxxxxxxxxxxxxxxxx, remove 'online.')
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
.
- Follow-Ups:
- RE: WebClient and File Download
- From: Walter Wang [MSFT]
- RE: WebClient and File Download
- Prev by Date: Re: Question about filenames
- Next by Date: RE: WebClient and File Download
- Previous by thread: Re: Question about filenames
- Next by thread: RE: WebClient and File Download
- Index(es):
Relevant Pages
|