Download a file from web in .Net

This article is just written to help people with this task if they don’t know how to do. As you will see there’s not so much code to write to do this, it’s just provided by the .Net Framework

All that you have to do is:

  • add a reference to System.Net namespace
  • create a new WebClient object
  • call the WebClient method DownloadFile

it’s done.

Example:

Imports System.Net

public sub DownloadFile(SourceURL as string, DestFile as string)
dim WebC as new WebClient()

WebC.DownloadFile(SourceURL,DestFile)
end sub


TAGS: Asp.net, dotnet, code snippet, seo, search engine optimization, visual studio.net, sample code, c#, vb.net

Leave a comment

Name:

eMail:

Website:

Comment: