我正在使用以下代码从 FTP 下载文件。
NetworkCredential credential = new NetworkCredential(Properties.Settings.Default.FTPUserName, Properties.Settings.Default.FTPPassword);
string inputfilepath = Path.Combine(Properties.Settings.Default.LocalDownloadFolder, file);
string ftpfullpath = Properties.Settings.Default.FTPSite + Properties.Settings.Default.FTPFolder + file;
WebClient request1 = new WebClient();
request1.Credentials = credential;
request1.DownloadFile(ftpfullpath, inputfilepath);
前两个变量的值是:
E:\FTPDownloads\CardholderManagementReport_1030_2012-12-11.xls
ftp://abc.com/AKSHAY/CardholderManagementReport_1030_2012-12-11.xls
它显示错误为:
The remote server returned an error: (550) File unavailable (e.g., file not found, no access).
编辑:我可以看到该文件确实存在那里,凭据是好的,我可以使用 FileZilla 下载它