2
我試圖從公共FTP服務器下載文件。這裏是我的C#源代碼:獲取421錯誤
FtpWebRequest request = FtpWebRequest.Create(new Uri("ftp://ftp.exotic-guild.de/test.exe")) as FtpWebRequest;
request.Credentials = new NetworkCredential("[email protected]", "");
request.UsePassive = true;
request.UseBinary = true;
request.KeepAlive = true;
request.Method = WebRequestMethods.Ftp.DownloadFile;
FtpWebResponse response = request.GetResponse() as FtpWebResponse;
System.IO.Stream responseStream = response.GetResponseStream();
responseStream.Close();
response.Close(); //Closes the connection to the server
這裏是臨客從public_ftp服務器的文檔:wolkenbauer anonymus ftp documentation。