Click here to Skip to main content
15,888,454 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
hi I need to connect to a device via ftp, change directory to system and then get some files from it. I use code below
C#
reqFTP = (FtpWebRequest)WebRequest.Create
    (new Uri("ftp://" + ftpServerIP + "/system/" + fileName));
reqFTP.Method = WebRequestMethods.Ftp.DownloadFile;
reqFTP.UseBinary = true;
reqFTP.UsePassive = false;
reqFTP.Credentials = new NetworkCredential(ftpUserID, ftpPassword);
FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();

I also tried the Uri like this
C#
Uri("ftp://" + ftpServerIP + "/%2fsystem/" + fileName)

but the device answers:
550 Cannot find the file /system/filename.\r\n

:( but when i use the socket programming and send the command
C#
"CWD " + directoryName
I am able to get the file. what's wrong with FtpWebRequest??
Posted

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900