How to download a file using ASP.NET?
Hi,
I would like to offer in my web application the posibility of downloading a file, but I always get the following error:
Access denied to "C:\WINDOWS\system32\earthday05.gif".
My code is:
//string address = "http://www.google.com/logos/earthday05.gif"; This doesn't work neither
string address = "http://www.google.com/logos/";
string fileName = "earthday05.gif";
System.Net.WebClient webclient = new System.Net.WebClient();
webclient.DownloadFile(address, fileName);
The previous code is just an exaple of downloading the picture of the Google main page, and I get the same error if I try to download a file from my server.
Thanks,
goraperas
Stan GershengorenRank #4,252 · 355 reputationPosted Apr 22, 2005, 5:25 AM EDT
goraperas56 reputationPosted Apr 24, 2005, 11:16 PM EDT
Stan GershengorenRank #4,252 · 355 reputationPosted Apr 25, 2005, 9:39 AM EDT
goraperas56 reputationPosted Apr 25, 2005, 10:51 AM EDT
Stan GershengorenRank #4,252 · 355 reputationPosted Apr 25, 2005, 11:49 AM EDT
goraperas56 reputationPosted Apr 26, 2005, 12:33 AM EDT
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts