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 can not access FTP. It gives the following error:
The remote server returned an error: (501) Syntax error in parameters or arguments.
I have searched extensively on this error, 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);
}