0

I have a Win Form with a picture gallery that uses FtpWebRequest to upload pictures, but after changing to .Net 4.0 I suddenly get 550 error. The error occurs both when uploading files and listing directory. As seen in my example-code I have implemented the MS solution from http://support.microsoft.com/kb/2134299.

I have checked the username, password and path - everything is correct.

Still, I get an error. I have skimmed Google for every solution without any response.

SetMethodRequiredCWD();

FtpWebRequest reqFTP = (FtpWebRequest)WebRequest.Create(new Uri(pPath));
reqFTP.Credentials = new NetworkCredential(Properties.Settings.Default.FTPUser, Properties.Settings.Default.FTPPass);
reqFTP.Method = WebRequestMethods.Ftp.ListDirectory;
reqFTP.KeepAlive = false;

FtpWebResponse respFTP = (FtpWebResponse)reqFTP.GetResponse();

Stream respStreamFTP = respFTP.GetResponseStream();
StreamReader streamReader = new StreamReader(respStreamFTP, Encoding.Default);
baddaydaddy
  • 604
  • 8
  • 25

2 Answers2

3

One approach I would recommend is to monitor the request/response exchange between the ftp-client and -server using e.g. Fiddler.

First, record a session in which the error does not manifest by manually using a third party client such as Filezilla to upload the file. Then, record another session with your program as the client. Comparing the exchanged messages may yield some insight to what is wrong.

Andreas Warberg
  • 542
  • 6
  • 12
2

Try to enable Network Tracing: http://msdn.microsoft.com/en-us/library/a6sbz1dx%28v=vs.100%29.aspx

Jacob
  • 39
  • 2