0

我一直在挖掘关于如何在 C# 中正确登录 FTP 的大量帖子,但是当我实际尝试时,它不起作用。通过我的阅读,我开始认为这是因为我的用户名中有“at”符号。这是真的还是似乎还有其他问题?我可以使用 FileZilla 登录没问题。

var file = f.Element("FILE_PATH").Value;
string ftpHost = "myFTP.com";

var URI = @"ftp://" + ftpHost + "/download/" + file; 
FtpWebRequest ftp = (FtpWebRequest)FtpWebRequest.Create(URI);
ftp.Credentials = new NetworkCredential(@"me@mysite.com", "Password");
ftp.UseBinary = true;
ftp.Method = WebRequestMethods.Ftp.DownloadFile;

FtpWebResponse ftpResponse = (FtpWebResponse)ftp.GetResponse();
4

0 回答 0