Jaa


IWebSocketControl2.IgnorableServerCertificateErrors Property

Definition

Gets a list of ignorable server certificate errors. Get this list and add ChainValidationResult values for server certificate errors that you wish to ignore during the secure WebSocket (wss:// protocol) server certificate validation process.

public:
 property IVector<ChainValidationResult> ^ IgnorableServerCertificateErrors { IVector<ChainValidationResult> ^ get(); };
IVector<ChainValidationResult> IgnorableServerCertificateErrors();
public IList<ChainValidationResult> IgnorableServerCertificateErrors { get; }
var iVector = iWebSocketControl2.ignorableServerCertificateErrors;
Public ReadOnly Property IgnorableServerCertificateErrors As IList(Of ChainValidationResult)

Property Value

A list of ChainValidationResult values indicating the server certificate errors to ignore when validating server certificates. By default, the list is empty, and all errors cause validation to fail.

Examples

The following example demonstrates how to ignore the ChainValidationResult.Untrusted error when you are connecting to a server that uses a self-signed certificate. The code adds the appropriate value to the IgnorableServerCertificateErrors list before calling ConnectAsync on the web socket. The server's self-signed certificate will not cause validation to fail, but other errors in validating the server certificate would still result in ConnectAsync failing.

private async void CreateAndConnectWebSocket()
{
    var myWebSocket = new MessageWebSocket();
    myWebSocket.Control.IgnorableServerCertificateErrors.Add(ChainValidationResult.Untrusted);

    // ...

    await myWebSocket.ConnectAsync(new Uri("wss://contoso.com/wsendpoint1"));
}

Applies to