System.Net.Security.SslStream.BeginAuthenticateAsClient Method

Called by clients to begin an asynchronous operation to authenticate the server and optionally the client using the specified certificates and security protocol.

Syntax

public virtual IAsyncResult BeginAuthenticateAsClient (string targetHost, System.Security.Cryptography.X509Certificates.X509CertificateCollection clientCertificates, System.Security.Authentication.SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState)

Parameters

targetHost
The name of the server that shares this System.Net.Security.SslStream.
clientCertificates
The System.Security.Cryptography.X509Certificates.X509CertificateCollection containing client certificates.
enabledSslProtocols
The System.Security.Authentication.SslProtocols value that represents the protocol used for authentication.
checkCertificateRevocation
A bool value that specifies whether the certificate revocation list is checked during authentication.
asyncCallback
An AsyncCallback delegate that references the method to invoke when the authentication is complete.
asyncState
A user-defined object that contains information about the operation. This object is passed to the asyncCallback delegate when the operation completes.

Returns

An IAsyncResult object that indicates the status of the asynchronous operation.

Remarks

The value specified for targetHost must match the name on the server's certificate.

The asynchronous authentication operation must be completed by calling the SslStream.EndAuthenticateAsClient(IAsyncResult) method. Typically, the method is invoked by the asyncCallback delegate.

This method does not block while the operation completes. To block until the operation completes, use one of the erload:System.Net.Security.SslStream.AuthenticateAsClient method overloads.

For detailed information about using the asynchronous programming model, see Asynchronous Programming Overview

If you receive a System.Security.Authentication.AuthenticationException, this System.Net.Security.SslStream is no longer useable. You should close this object and remove all references to it so that it can be collected by the garbage collector.

Note:

Client certificates are not supported in the SSL version 2 protocol.

Requirements

Namespace: System.Net.Security
Assembly: System (in System.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0