Hi,
We are using Xceed FTP for long time. It was working fine until the last week. We updated our XCeed FTP to latest Xceed FTP.v5.1 version after that it does not connect to secure ftp's. Even on CertificateReceived handler we accept the e.Action = VerificationAction.Accept; if it is invalid certificate.
Is there any changed on newer version? i don't see any changes on documentation also.
here the sample code for you..
fc = new Xceed.Ftp.FtpClient();
fc.CertificateReceived += new CertificateReceivedEventHandler(fc_CertificateReceived);
fc.CommandSent += new CommandSentEventHandler(fc_CommandSent);
fc.ReplyReceived += new ReplyReceivedEventHandler(fc_ReplyReceived);
fc.StateChanged += new EventHandler(fc_StateChanged);
fc.FileTransferStatus += new FileTransferStatusEventHandler(fc_FileTransferStatus);
fc.ParsingListingLine += new ParsingListingLineEventHandler(fc_ParsingListingLine);
fc.RepresentationType = RepresentationType.Ascii;
int ftpPortNo = string.IsNullOrEmpty(portno.Trim()) ? 0 : int.Parse(portno.Trim());
//implicit secure ftp default port no #990
if (IsSecured && ftpPortNo == 0) ftpPortNo = 990;
//implicit ftp default port no #21
if (!IsSecured && ftpPortNo == 0) ftpPortNo = 21;
FTPLog(string.Format("Trying to connect with ftpaddress:{0}, portno#{1}...",ftpaddr,ftpPortNo));
if (IsSecured)
fc.Connect(ftpaddr, ftpPortNo,AuthenticationMethod.Tls,VerificationFlags.None,null);
else
fc.Connect(ftpaddr, ftpPortNo);
and the certificatereceived handler
private void fc_CertificateReceived(object sender, CertificateReceivedEventArgs e)
{
if (e.Status != VerificationStatus.ValidCertificate)
{
e.Action = VerificationAction.Accept;
}
}
After the latest version of Xceed FTP it broken live now. Need a thought to fix it.
here is the error..
Message: FTP State Changed: Connecting
Message: FTP State Changed: NotConnected
Message: Xceed.Ftp.FtpException: A Xceed.Ftp.FtpSslException occurred while receiving a reply. Please see and report the value of the InnerException property, which contains the actual exception and stack trace. ---> Xceed.Ftp.FtpSslException: SslStream authentication failed. Possible causes: 1) The server requires a certificate in order to connect and none was provided. 2) The certificate provided was rejected by the .NET framework/Windows (usually because it doesn't contain a private key). 3) The certificate provided was rejected by the server. ---> System.ArgumentException: The verification status is invalid.
Parameter name: status
at Xceed.Ftp.CertificateReceivedEventArgs..ctor(Certificate certificate, VerificationFlags flags, VerificationStatus status)
at Xceed.Ftp.Engine.FtpCommandChannel.OnServerCertificateValidationCallback(Object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
at System.Net.Security.SecureChannel.VerifyRemoteCertificate(RemoteCertValidationCallback remoteCertValidationCallback)
at System.Net.Security.SslState.CompleteHandshake()
at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
at Xceed.Ftp.Engine.FtpCommandChannel.get_CommandChannelStream()
--- End of inner exception stack trace ---
at Xceed.Ftp.Engine.FtpCommandChannel.get_CommandChannelStream()
at Xceed.Ftp.Engine.FtpCommandChannel.ReceiveReplyOperation.ReadOperationCompleted(IAsyncResult asyncResult)
--- End of inner exception stack trace ---
at Xceed.Ftp.Engine.ConnectFtpCommand.Execute(FtpCommandChannel commandChannel)
at Xceed.Ftp.Engine.BaseFtpCommand.BackgroundWorker_DoWork(Object sender, DoWorkEventArgs e)
at Xceed.Ftp.Engine.ConnectFtpCommand.EndExecute(IAsyncResult asyncResult)
at Xceed.Ftp.FtpClient.Connect(String hostName, Int32 port, AuthenticationMethod authenticationMethod, VerificationFlags verificationFlags, Certificate clientCertificate)
at SnapShotExtract.AllExtractsFTP.FTPFile(ArrayList filelist, String ftpaddr, String usrname, String pwd, String portno, Boolean IsSecured) in C:\CentrisSourceRepository\Dev\Source\ObjectSolutions\Source\SnapShotExtract\AllExtractsFTP.cs:line 514
Thanks,
Raj