System.Net.Security.SslStream.AuthenticateAsClient Method

Called by clients to authenticate the server and optionally the client in a client-server connection.

Syntax

public virtual void AuthenticateAsClient (string targetHost)

Parameters

targetHost
The name of the server that shares this System.Net.Security.SslStream.

Remarks

This method authenticates using System.Security.Authentication.SslProtocols.Default. No client certificates are used in the authentication. The certificate revocation list is not checked during authentication. The value specified for targetHost must match the name on the server's certificate.

When authentication succeeds, you must check the SslStream.IsEncrypted and SslStream.IsSigned properties to determine what security services are used by the System.Net.Security.SslStream. Check the SslStream.IsMutuallyAuthenticated property to determine whether mutual authentication occurred.

If the authentication fails, you receive a System.Security.Authentication.AuthenticationException, and 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