-1

I am using the following code to download file from 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);

Values of the first two vaiables is:

E:\FTPDownloads\CardholderManagementReport_1030_2012-12-11.xls
ftp://abc.com/AKSHAY/CardholderManagementReport_1030_2012-12-11.xls

It shows error as :

The remote server returned an error: (550) File unavailable (e.g., file not found, no access).

EDIT: I can see that the file is indeed present there, credentials are ok and I can download it using FileZilla

Akshay J
  • 5,362
  • 13
  • 68
  • 105

2 Answers2

0

The error 550 returned by the FTP server indicates that the user you are using to try and access the file with does not have permission to access the file.

Either use some other set of credentials that has access to the file or change the permissions on the file to allow access.

Justin Pearce
  • 4,994
  • 2
  • 24
  • 37
  • request1.Credentials = credential; This lne sets the credentials and it is created in a line that I have not mentioned in the code. – Akshay J Dec 12 '12 at 15:29
0

This makes it work.
ftp://abc.com/%2f/AKSHAY/CardholderManagementReport_1030_2012-12-11.xls
Explaination is also there.

Akshay J
  • 5,362
  • 13
  • 68
  • 105