This project is read-only.

No connection to the server has been established

Feb 26, 2013 at 1:04 AM
Dear All,
When I am trying to run the below code, I got this error:
"No connection to the server has been established."

ftp.Credentials = new System.Net.NetworkCredential("username", "passwordl");
       // ftp.ConnectTimeout = System.Threading.Timeout.Infinite;    
        ftp.Port = 990;
        ftp.ReadTimeout = System.Threading.Timeout.Infinite;
        ftp.DataConnectionEncryption = true;
        ftp.Host = "mycomputer";
        ftp.EncryptionMode = FtpEncryptionMode.Explicit   ;
        ftp.DataConnectionType = FtpDataConnectionType.AutoPassive ;
        //ftp.ValidateCertificate += new FtpSslValidation(ftp_ValidateCertificate);
        ftp.EnableThreadSafeDataConnections = false; 
        ftp.ValidateCertificate += new FtpSslValidation(OnValidateCertificate);
       // ftp.EncryptionMode = FtpEncryptionMode.Implicit  ;


static void OnValidateCertificate(System.Net.FtpClient.FtpClient control,System.Net.FtpClient.FtpSslValidationEventArgs e)

            // invalid cert, do you want to accept it?
            e.Accept = true;

Please some help?
Feb 26, 2013 at 2:10 AM
Change your encryption mode to implicit for port 990.
Feb 26, 2013 at 3:34 PM
I did change it
ftp.EncryptionMode = FtpEncryptionMode.Implicit, but I got the below error

"The FtpSocketStream object is not connected."
Feb 26, 2013 at 10:08 PM
I have no idea. Don't see a problem with the code, try a different FTP server, ftp/ftp, ftp/ftp, etc...
Feb 26, 2013 at 10:09 PM
Try without encryption and don't specify the port unless it's a non-standard port, it's automatically determined based on encryption type or no encryption.