0 votes
by (330 points)
edited

I get this error when trying to transfer a file using FTPS. I think this is related to accepting certificates.

This is a portion of my code:

TlsParameters par = new TlsParameters();

            par.CertificateVerifier = CertificateVerifier.AcceptAll;

            ftp.Connect(hostname, 21, par, FtpSecurity.Unsecure);
            ftp.Login(username, password);
            ftp.TransferType = FtpTransferType.Ascii;

            ftp.ChangeDirectory(dirChange);

            long bytes;
            if (method == "get")
            {
                bytes = ftp.GetFile(remoteFile, localFile);
            }

I have tried several options and either I get the error above or the connection times out.

I also tried to get a list of files which times out also. It times out at the point the passive command is given.

ftp.Connect(hostname); ftp.Secure(); ftp.Login(username, password);

            string original = ftp.GetCurrentDirectory();
            ftp.ChangeDirectory(dirChange);

            FtpList files = ftp.GetList();
            string[] arrFiles = new string[files.Count];

            for (int i = 0; i < files.Count; i++)
            {
                arrFiles[i] = files[i].Name;
            }
            return arrFiles;
Applies to: Rebex FTP/SSL
by (144k points)
edited

Please use Ftp object's LogWriter property (as described at http://www.rebex.net/kb/logging.aspx) to create a communication log showing both of these issues and add it to your post or mail it to support@rebex.net for analysis - then we should be able to tell more.

1 Answer

0 votes
by (330 points)
edited

I am not getting this error anymore. Several things have changed including getting a new version of the FTPS component.

...