FTPWebRequest 530 Error: Not Logged in issue

2019-03-03 07:20发布

I have been digging through a mountain of posts on how to properly login to FTP in C# but when I actually try, it does not work. Through my readings I have come to think that it is because my username has the 'at' symbol in it. Is this true or is does it appear that there is something else wrong? I am able to login using FileZilla no problem.

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();

0条回答
登录 后发表回答