Downloading a File - Codoid
Select Page
Codoid Blog

Downloading a File

Irrespective of the business that your client is in, marketing is an integral part of their operations. In fact, in this day and age of social.

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.

Written By

Submit a Comment

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


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.