Archived Forum Post

Index of archived forum posts

Question:

Explicit FTP on TLS

Oct 08 '15 at 14:24

Greetings,

I am able to establish a connection to a secure FTP server using Filezilla with the log below


Status: Resolving address of ftp1.supplywholesale.co.nz Status: Connecting to 203.44.12.166:21... Status: Connection established, waiting for welcome message... Status: Initializing TLS... Status: Verifying certificate... Status: TLS connection established. Status: Connected Status: Retrieving directory listing... Status: Directory listing of "/" successful


but attempting to do this programatically using FTP2 and C# just does not work - always returning a 301 (login) error- but I know the username and password are correct

Code is : Chilkat.Ftp2 myftp = new Chilkat.Ftp2(); bool unlock = myftp.UnlockComponent("K...................................."); myftp.AuthTls = true; myftp.Ssl = false; myftp.Hostname = "ftp1.supplywholesale.co.nz"; myftp.ConnectOnly(); myftp.ClearControlChannel(); myftp.ConvertToTls();

        myftp.Username = "garth.holden@korzoo.co.nz";
        myftp.Password = "z.............";

        myftp.LoginAfterConnectOnly();

        bool success= myftp.Connect();

Any help would be appreciated


Answer

Remove the calls to ClearControlChannel and ConvertToTls -- they are not needed. When the AuthTls property = true, the connection is automatically converted to TLS. Examine the LastErrorText after calling ConnectOnly to see..


Answer

Thanks your help much - connects OK after myftp.ConnectOnly() Weird the 301 error after the myftp.Username = "garth.holden@korzoo.co.nz"; myftp.Password = "z.............";

    myftp.LoginAfterConnectOnly();

as I know the username and password are correct (copied over directly from filezilla)


Answer

Suddenly burst into like, many thanks for your help