(HELP) i need a button that downloads something from a web adress
ok i have this code
here it is
Code:
void DownloadFileFromURL(string URL, string SaveFileName)
{
Uri u = new Uri(URL);
Stream s = ((HttpWebRequest)HttpWebRequest.Create(u)).GetResponse().GetResponseStream();
FileStream f = File.Create(SaveFileName);
byte[] r = new byte[4096];
while (true)
{
int num = s.Read(r, 0, 4096);
if (num < 1)
break;
f.Write(r, 0, num);
}
}
when i debug and i click the button it takes me to the code and it highlights this part of the code
Uri u = new Uri(URL);
please help me get this to work