When I try downloadfile, I always get
"An unhandled exception of type 'System.Net.WebException' 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 myStringWebResource 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.
myStringWebResource = remoteUri + fileName
Console.WriteLine("Downloading File ""{0}"" from ""{1}"" ......." +
ControlChars.Cr + ControlChars.Cr, fileName, myStringWebResource)
' The DownloadFile() method downloads the Web resource and saves it
into the current file-system folder.
myWebClient.DownloadFile(myStringWebResource, fileName)
Console.WriteLine("Successfully Downloaded file ""{0}"" from
""{1}""", fileName, myStringWebResource)
Console.WriteLine((ControlChars.Cr + "Downloaded file saved in the
following file system folder:" + ControlChars.Cr + ControlChars.Tab +
Application.StartupPath))
End Function
"Cor" <no*@non.com> wrote in message
news:uR**************@TK2MSFTNGP11.phx.gbl...
Hi Ken,
Why would you do that?
Dim img As Bitmap
Dim wc As New System.Net.WebClient
img = New
Bitmap(wc.OpenRead("http://images.ibsys.com/orlc/images/weather/auto/doppler _640x480.gif"))
You convert the gif while you can do
webclient.downloadfile("http://images.ibsys.com/orlc/images/weather/auto/dop pler_640x480.gif")
Cor