Download and save file to server from a URL (HTTP)

  • Thread starter Thread starter Max
  • Start date Start date
M

Max

I need help in vb.net to download a binary file off another web site and
save to it to the server. Not from the client. Server to server. Can anyone
point me to the right classes to use at least? filestream.. one of the web
classes... ??

-Max
 
Max said:
I need help in vb.net to download a binary file off another web site
and save to it to the server. Not from the client. Server to server.
Can anyone point me to the right classes to use at least?
filestream.. one of the web classes... ??

There is no such thing as server to server in HTTP. One participating server
will always act as a client from a logical POV. Check out
System.Net.WebClient or System.Net.WebRequest/WebResponse for advanced
applications.

Cheers,
 
Thanks for the clearification. Amazingly the webclient class did the trick
with only one line of code! Wohoo!
---------------------------------
Dim client As New WebClient
Dim strURL As String = "http://www.someurl.com/sendfile.php?file=myfile.gz"
Dim strFilename As String = Server.MapPath("myfile.gz")

client.DownloadFile(strURL, strFilename)
----------------------------------
 
Back
Top