Downloading a file is very simple in .NET and only few lines are required.
Code
Dim oNetwork,strServerLocation,strClientLocation
'URL of the file which you want to download
strServerLocation="http://ist.psu.edu/current-students/pdf/resume-objective-
statements.pdf"
'Specify where to save it along with the file name including file extension.
strClientLocation="C:DownloadHere.pdf"
'Creating Network object
Set oNetwork=
DotNetFactory.CreateInstance("Microsoft.VisualBasic.Devices.Network","Microsoft.Vi
sualBasic")
'Downloading the file into specified client location
oNetwork.DownloadFile strServerLocation,strClientLocation
Set oNetwork =Nothing
Synopsis
Once the above code is run, the file will be downloaded at the specified client location.
We can also ping a server and upload a file using Network class.
Comments(0)