Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to download a file from a URL in C#?

What is a simple way of downloading a file from a URL path?

like image 745
vbroto Avatar asked Nov 21 '08 02:11

vbroto


People also ask

How to download file from URL using c#?

The simply way how to download file is to use WebClient class and its method DownloadFile. This method has two parameters, first is the url of the file you want to download and the second parameter is path to local disk to which you want to save the file.


1 Answers

using (var client = new WebClient()) {     client.DownloadFile("http://example.com/file/song/a.mpeg", "a.mpeg"); } 
like image 164
Raj Kumar Avatar answered Sep 29 '22 17:09

Raj Kumar