Event is fired to validate SSL certificates. If this event is
not handled and there are errors validating the certificate
the connection will be aborted.
Namespace: System.Net.FtpClient
Assembly: System.Net.FtpClient (in System.Net.FtpClient.dll) Version: 1.0.5064.17461
Syntax
Examples
C# |
Copy
|
using System;
using System.Net;
using System.Net.FtpClient;
namespace Examples {
public static class ValidateCertificateExample {
public static void ValidateCertificate() {
using (FtpClient conn = new FtpClient()) {
conn.Host = "localhost";
conn.Credentials = new NetworkCredential("ftptest", "ftptest");
conn.EncryptionMode = FtpEncryptionMode.Explicit;
conn.ValidateCertificate += new FtpSslValidation(OnValidateCertificate);
conn.Connect();
}
}
static void OnValidateCertificate(FtpClient control, FtpSslValidationEventArgs e) {
if (e.PolicyErrors != System.Net.Security.SslPolicyErrors.None) {
}
}
}
}
|
See Also