首页 新闻 会员 周边

ftp获取文件夹目录问题

0
悬赏园豆:5 [待解决问题]

我使用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,什么原因?网上百度的都试过了。

灬丶的主页 灬丶 | 初学一级 | 园豆:2
提问于:2019-04-02 11:27
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册