StreamWebSocketInformation.ServerCertificate 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
當建立安全 WebSocket 連線時,會取得伺服器提供的憑證。
public:
property Certificate ^ ServerCertificate { Certificate ^ get(); };
Certificate ServerCertificate();
public Certificate ServerCertificate { get; }
var certificate = streamWebSocketInformation.serverCertificate;
Public ReadOnly Property ServerCertificate As Certificate
屬性值
伺服器憑證。
實作
Windows 需求
| 規格需求 | Description |
|---|---|
| 裝置系列 |
Windows 10 Anniversary Edition (已於 10.0.14393.0 引進)
|
| API contract |
Windows.Foundation.UniversalApiContract (已於 v3.0 引進)
|
備註
當伺服器憑證透過此屬性取得時,SSL 連線已經建立。
如果你想在連線過程中檢查伺服器憑證以執行自訂驗證,你應該註冊一個處理程序來處理 StreamWebSocket.ServerCustomValidationRequested 事件,並在該處理程序中執行自訂伺服器驗證。
如果你只是想在伺服器憑證驗證時忽略某些錯誤類別(例如,你使用自簽憑證並想忽略因此條件引起的驗證錯誤),你可以使用 IgnorableServerCertificateErrors 屬性來忽略相關錯誤類別。