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

vbroto picture vbroto · Nov 21, 2008 · Viewed 505.7k times · Source

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

Answer

Raj Kumar picture Raj Kumar · Nov 21, 2008
using (var client = new WebClient())
{
    client.DownloadFile("http://example.com/file/song/a.mpeg", "a.mpeg");
}