views:

213

answers:

1

Hi,

I'm trying to read a file that I have a web address for into a byte array. I've been using File.ReadAllBytes to read files locally and I've been unable to figure out the cleanest way to do this for a file on the web.

I imagine this is just a quick snippet of code, but everything I can find through search is only for local files.

Thanks!

+4  A: 
byte[] response = new System.Net.WebClient().DownloadData(url);
Mehrdad Afshari
Fantastic! Thanks for the speedy response!
impulse3d
Not sure if that WebClient will dispose, better to wrap it in a using surely?
JL