Share via


MessageWebSocketControl.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 = messageWebSocketControl.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.

Implements

Windows requirements

Device family
Windows 10 Anniversary Edition (introduced in 10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v3.0)

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.Information.IgnorableServerCertificateErrors.Add(ChainValidationResult.Untrusted);

    ...

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

}

Applies to