我使用ftp类来获取文件夹目录,然后来判断是否包含某个目录,但是一直获取到的为null,被动和主动模式都试过了
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(uri));
reqFTP.UseBinary = true;
reqFTP.Credentials = new NetworkCredential("1", "111");
reqFTP.KeepAlive = false;
reqFTP.Method = WebRequestMethods.Ftp.ListDirectory;
reqFTP.UsePassive = true;
WebResponse response = reqFTP.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());
string line = reader.ReadLine();
但是获取到的line一直为null,什么原因?网上百度的都试过了。