(503) Bad sequence of commands.
I ran into this problem too, also when downloading a number of files. During the operation, the FTP QUIT command was never being issued, so a subsequent attempt to log onto and fetch a file reused the same connection, on which the user was still logged in. The underlying error was not "503 Bad sequence of commands" but "503 You are already logged in!".
So you could modify your code to reuse the existing connection to download subsequent files, or add
FtpWebRequest request = (FtpWebRequest)WebRequest.Crea te(ftppath);
request.KeepAlive=False
to the web request, and it will force the FTP QUIT command to be issued when you close it.
I ran into this problem too, also when downloading a number of files. During the operation, the FTP QUIT command was never being issued, so a subsequent attempt to log onto and fetch a file reused the same connection, on which the user was still logged in. The underlying error was not "503 Bad sequence of commands" but "503 You are already logged in!".
So you could modify your code to reuse the existing connection to download subsequent files, or add
FtpWebRequest request = (FtpWebRequest)WebRequest.Crea
request.KeepAlive=False
to the web request, and it will force the FTP QUIT command to be issued when you close it.
No comments:
Post a Comment