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?
– Tony
How are you doing to open the connection? Have a code example?
– Leonel Sanches da Silva
@Tony, they don’t have proxy, and in the Windows firewall, I released normal, like I do in others.
– Jéf Bueno
@Ciganomorrisonmendez, I’ll do an EDIT
– Jéf Bueno
What is the format of
enderecoUltimaVersao
?– Leonel Sanches da Silva
Add to the question the contents of "addressUltimaVersao".
– Tony
This is the address "ftp: //meusite.com.br/folder/version", @Ciganomorrisonmendez
– Jéf Bueno
I didn’t understand this line
string file = reader.ReadLine();false);
what this meansfalse)
?– Guilherme Nascimento
@Guilhermenascimento was a line I erased in half, I corrected the question.
– Jéf Bueno