By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,115 Members | 894 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,115 IT Pros & Developers. It's quick & easy.

c#: error 503 with FtpWebRequest

P: 1
The following code is giving me an error 503, with the message "The remote server returned an error: (503) Bad sequence of commands." The StatusDescription is "503 You are already logged in!\r\n".

The error happens on the line
requestStream = request.GetRequestStream();

It only happens after the code is run several times. Between runs I have it waiting ten seconds. (The at() and atnl() methods display text messages in a window.)

Ideas? tia, Bill

-------------------

FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://bdluv.com/default.html");
request.Method = WebRequestMethods.Ftp.UploadFile;
request.Credentials = new NetworkCredential("u40312124-sensors", "pw");
request.ContentLength = htmlbytes.Length;
try
{
Stream requestStream;
requestStream = request.GetRequestStream();
requestStream.Write(htmlbytes, 0, htmlbytes.Length);
//requestStream.Flush();
requestStream.Close();
FtpWebResponse response = (FtpWebResponse)request.GetResponse();
atnl(); at("ftp upload done; status=" + response.StatusDescription);
response.Close();
Aug 18 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.