我正在使用以下代碼從FTP下載文件。C#WebClient從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);
前兩個vaiables的價值觀是:
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下載它
問題是什麼?你不明白錯誤信息嗎? –
這個答案對你有幫助嗎? http://stackoverflow.com/a/6098905/435693 – Morvader