I am trying to list file data using FtpWebRequest, but very often it fails using WebException and shows error 530 The user is not logged in.
How is it possible that it works for a while using the same credentials?
Code excerpt:
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(ftpuri)); reqFTP.UseBinary = true; reqFTP.Credentials = new NetworkCredential(userName, password); string[] downloadFiles = new string[0]; reqFTP.Method = WebRequestMethods.Ftp.ListDirectoryDetails; WebResponse response = reqFTP.GetResponse(); StreamReader reader = new StreamReader(response.GetResponseStream()); downloadFiles = reader.ReadToEnd().Replace("\r\n", "¤").Split('¤'); reader.Close(); response.Close();
Henrik
source share