Error 501 when connecting with FTP

Asked

Viewed 434 times

2

I have a C# (Windows Forms) application that accesses the company’s FTP to download some files and/or upload.

Only, on two specific clients, the application cannot access FTP. It gives the following error:

The remote server returned an error: (501) Syntax error in parameters or arguments.

I have searched extensively about this mistake, but there is nothing significant.

What can it be?

My code

string enderecoUltimaVersao = "ftp://meusite.com.br/releases/ultima";

FtpWebRequest request = FtpWebRequest.Create(enderecoUltimaVersao) as FtpWebRequest;
request.Method = WebRequestMethods.Ftp.ListDirectory;
request.Credentials = new NetworkCredential(user, senha);
request.UsePassive = true;
request.UseBinary = true;
request.KeepAlive = false;

FtpWebResponse response = request.GetResponse() as FtpWebResponse;
Stream responseStream = response.GetResponseStream();
StreamReader reader = new StreamReader(responseStream);

while (!reader.EndOfStream)
{
    string file = reader.ReadLine();
    files.Add(file);
}
  • Could be something to do with the Firewall/Proxy of these networks causing Error 501?

  • How are you doing to open the connection? Have a code example?

  • @Tony, they don’t have proxy, and in the Windows firewall, I released normal, like I do in others.

  • @Ciganomorrisonmendez, I’ll do an EDIT

  • What is the format of enderecoUltimaVersao?

  • Add to the question the contents of "addressUltimaVersao".

  • This is the address "ftp: //meusite.com.br/folder/version", @Ciganomorrisonmendez

  • I didn’t understand this line string file = reader.ReadLine();false); what this means false)?

  • @Guilhermenascimento was a line I erased in half, I corrected the question.

Show 4 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.