The title seems contradictory? Read on...
I am attempting to list a folder on an FTP server using FtpWebRequest.
When I list a single folder "myserver.whatever.com/folder" It succeeds.
When I list a nested folder, "myserver.whatever.com/folder/folder1" It fails. Except it throws an exception that tells me it succeeds.
Specifically, this code:
request = (FtpWebRequest)WebRequest.Create(m_server + folder);
request.ClientCertificates = m_certificates;
request.Credentials = new NetworkCredential(m_userName.Normalize(), password.Normalize() );
request.EnableSsl = true;
request.Method = WebRequestMethods.Ftp.ListDirectory;
response = (FtpWebResponse)request.GetResponse();
Stream responseStream = response.GetResponseStream();
StreamReader reader = new StreamReader(responseStream);
Throws this exception:
The remote server returned an error: 150 Opening data connection. List started\r\n
Does Microsoft not know that a code of 150 is NOT AN ERROR? It there any workaround for Microsoft's defect?
Based on other posts, I have already tried removing and reinstalling a number of KBs, to no avail.
If there was a way to issue a "chdir" with this the FtpWebRequest object, I might get around this problem. But I can't find anything.
It does not appear to be an access rights issue. Otherwise the server should return a 550.
There were some posts regarding session resumption on the data port, however, since this does NOT fail on one folder level, only on two, the data connection would not seem to be the problem.
Does anyone have any suggestions?