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;