When I try downloadfile, I always get
"An unhandled exception of type 'System.Net.Web Exception' occurred in
system.dll
Additional information: The remote server returned an error: (404) Not
Found."
I used the example from the documentation verbatim. Is this a LAN/firewall
issue possibly? I have tried to download image files which I can see in a
browser.
Function WebClientTest()
Dim remoteUri As String =
"http://www.contoso.com/library/homepage/images/"
Dim fileName As String = "ms-banner.gif"
Dim myStringWebReso urce As String = Nothing
' Create a new WebClient instance.
Dim myWebClient As New WebClient()
' Concatenate the domain with the Web resource filename. Because
DownloadFile
'requires a fully qualified resource name, concatenate the domain
with the Web resource file name.
myStringWebReso urce = remoteUri + fileName
Console.WriteLi ne("Downloadin g File ""{0}"" from ""{1}"" ......." +
ControlChars.Cr + ControlChars.Cr , fileName, myStringWebReso urce)
' The DownloadFile() method downloads the Web resource and saves it
into the current file-system folder.
myWebClient.Dow nloadFile(myStr ingWebResource, fileName)
Console.WriteLi ne("Successfull y Downloaded file ""{0}"" from
""{1}""", fileName, myStringWebReso urce)
Console.WriteLi ne((ControlChar s.Cr + "Downloaded file saved in the
following file system folder:" + ControlChars.Cr + ControlChars.Ta b +
Application.Sta rtupPath))
End Function
"Cor" <no*@non.com> wrote in message
news:uR******** ******@TK2MSFTN GP11.phx.gbl...
Hi Ken,
Why would you do that?
Dim img As Bitmap
Dim wc As New System.Net.WebC lient
img = New
Bitmap(wc.OpenR ead("http://images.ibsys.co m/orlc/images/weather/auto/doppler _640x480.gif"))
You convert the gif while you can do
webclient.downl oadfile("http://images.ibsys.co m/orlc/images/weather/auto/dop pler_640x480.gi f")
Cor