+2 votes

Hi,

ChangeFolder() and ChangeFolderUp() do not return the absolute path in my program (null is returned).
How can it be? Is there a fix?

by

1 Answer

0 votes

ChangeFolder returns the path returned by the server.

If the server is not returning folder name in its response null is returned.
You can use GetCurrentFolder method to request the current folder from the server.

using(Ftp ftp = new Ftp())
{
   ftp.Connect("ftp.server.com");  // or ConnectSSL for SSL
   ftp.Login("user", "password");

   ftp.ChangeFolder("subfolder");
   string currentFolder = ftp.GetCurrentFolder();

   ftp.Close();
}
by (301k points)
...