使用FtpWebRequest输出日志我想知道我的FTP客户端是否可以使用FtpWebRequest.就像这样:[R] USER xxx
[R] 331 Please specify the password.
[R] PASS (hidden)
[R] 230 Login successful.
[R] SYST
[R] 215 UNIX Type: L8
[R] FEAT
[R] 211-Features:
[R] EPRT
[R] EPSV
[R] MDTM
[R] PASV
[R] REST STREAM
[R] SIZE
[R] TVFS
[R] 211 End
[R] PWD
[R] 257 "/"
[R] CWD /
[R] 250 Directory successfully changed.
[R] PWD
[R] 257 "/"
[R] TYPE A
[R] 200 Switching to ASCII mode.
[R] PASV
[R] 227 Entering Passive Mode (10,232,201,81,141,175)
[R] Opening data connection IP: 10.232.201.81 PORT: 36271
[R] LIST -al
[R] 150 Here comes the directory listing.
[R] 226 Directory send OK.例如,当连接.我的当前代码只执行以下操作:// Get the object used to communicate with the server.FtpWebRequest request = (FtpWebRequest)WebRequest.Create(string.Format("ftp://{0}", addrEndPoint));request.Method = WebRequestMethods.Ftp.ListDirectoryDetails;request.Credentials = new NetworkCredential(_currentConnection.Username, _currentConnection.Password);FtpWebResponse response = (FtpWebResponse)request.GetResponse();Stream responseStream = response.GetResponseStream();StreamReader readStream = new StreamReader(responseStream, System.Text.Encoding.UTF8);if (readStream != null){ Console.WriteLine(readStream.ReadToEnd());}
2 回答
- 2 回答
- 0 关注
- 600 浏览
添加回答
举报
0/150
提交
取消