1

How do I download a CSV file from a web server to a local machine using HTTP?

Robert Harvey
  • 178,213
  • 47
  • 333
  • 501
user633558
  • 15
  • 2
  • 3

1 Answers1

4

Download file using WebClient:

string url = "urlToFile";
using (var client = new WebClient())
using(var file = File.Create("someFile.ext"))
{
  var bytes = client.DownloadData(uri);
  file.Write(bytes, 0, bytes.Length);   
}
Andrew Orsich
  • 52,935
  • 16
  • 139
  • 134