System.Net.Security.SslStream.BeginAuthenticateAsServer Method

Called by servers to begin an asynchronous operation to authenticate the client and optionally the server in a client-server connection.

Syntax

public virtual IAsyncResult BeginAuthenticateAsServer (System.Security.Cryptography.X509Certificates.X509Certificate serverCertificate, AsyncCallback asyncCallback, object asyncState)

Parameters

serverCertificate
The X509Certificate used to authenticate the server.
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 indicating the status of the asynchronous operation.

Remarks

This method authenticates using System.Security.Authentication.SslProtocols.Default. The certificate revocation list is not checked during authentication. The client is not required to provide a certificate for authentication.

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.

Requirements

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