Searching & download a single file in a website
Searching & download a single file out of thousands from particular directory using textbox
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Munesh SharmaRank #174 · 13.9K reputationPosted Apr 13, 2014, 11:23 PM EDT
private void buttonDownloadFile_Click(object sender, EventArgs e) { string url = @"http://www.thereforesystems.com/wp-content/uploads/2008/08/image35.png"; // Create an instance of WebClient WebClient client = new WebClient(); // Hookup DownloadFileCompleted Event client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted); // Start the download and copy the file to c:\temp client.DownloadFileAsync(new Uri(url), @"c:\temp\image35.png"); } void client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e) { MessageBox.Show("File downloaded"); }