Select Page
Codoid Blog

Downloading a File

Being a leading QA Company, we write blogs on all prominent software testing topics and tools using our real-world experience. So stay sharp by subscribing to our Newsletter.

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)

Submit a Comment

Your email address will not be published. Required fields are marked *

Talk to our Experts

Amazing clients who
trust us


poloatto
ABB
polaris
ooredo
stryker
mobility