6
Reply

How to download a file using ASP.NET?

goraperas

goraperas

Apr 22 2005 4:07 AM
8.9k
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

Answers (6)