Click here to Skip to main content
15,919,434 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I using this code for download file from FTP. SO I install new windows so the same code not working and give the following error.

The remote server returned an error: (550) File unavailable (e.g., file not found, no access)

public void FileDownload(string Servername, string username, string Pwd, string Filename)
        {
            try
            {             

                WebProxy prox = new WebProxy();
                prox.UseDefaultCredentials = true;
                WebClient request = new WebClient();              
                request.Credentials = new NetworkCredential(username, Pwd);
                request.Proxy = prox;               
                byte[] fileData = request.DownloadData(Servername + "/" + "/fashionretailkz/SHIPMENTFILES/IN/" + Filename);
                DirectoryInfo di = new DirectoryInfo(txtdrive.Text +@"\DownloadfilefrmTAP");
                if (di.Exists == false)
                    di.Create();

              FileStream file = File.Create(txtdrive.Text +@"\\DownloadfilefrmTAP\" + Filename);
                 file.Write(fileData, 0, fileData.Length);
                              file.Close();
            }
            catch (SystemException ex)
            {
                Logs.MakeLog(Application.StartupPath.ToString(), ex.ToString());
            }
            
        }


So please guide me what is the problem..


[edit]Code block added - OriginalGriff[/edit]
Posted
Updated 18-Jun-11 2:39am
v2

1 solution

OP wrote:
I install new windows

Yes, you forgot to give FTP-permission things.

C#: FTP Upload Error – The remote server returned an error: (550) File unavailable (e.g., file not found, no access).[^]
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 18-Jun-11 20:08pm    
A 5.
--SA

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