Click here to Skip to main content
15,915,164 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,
To download file, the following code works on localhost but not working on Web server. Can you help please?
string path = "ftp://mysite.in:21/" + filename;
            WebClient request = new WebClient();
            request.Credentials = new NetworkCredential("usrname", "password");
            byte[] filedata = request.DownloadData(path);
            FileStream file = File.Create(foldername + "/" + filename);
            file.Write(filedata, 0, filedata.Length);
            file.Close();
Posted
Comments
Sandeep Mewara 12-May-12 4:59am    
Elaborate 'now working' part.

1 solution

IIS 6 & the Visual Studio built in Web Server register things a bit differently than IIS 7. If your host is running IIS 7, you may need to add your registration to the <system.webserver> node in your Web.config file.

XML
<system.webServer>
  <handlers>
    <add ... />
  </handlers>
</system.webServer>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900