簡體   English   中英

WinRT UWP將客戶端證書附加到Web服務請求

[英]WinRT UWP Attach client Certificate to a Web Service request

在WinRT中是否可以將客戶端證書附加到SOAP客戶端請求? 在以前的版本中,您只需執行以下操作:

MyServiceSoapClient client = new MyServiceSoapClient()
X509Certificate2 cert = CertificateHelper.GetClientCertificate();
client.ClientCredentials.ClientCertificate.Certificate = cert;

但是ClientCertificate屬性似乎不再可用。 如何在UWP中實現這一目標?

謝謝。

嘗試這個:

var client = new ServiceClient();
client.Endpoint.Address = new EndpointAddress(url);

BasicHttpBinding binding = client.Endpoint.Binding as BasicHttpBinding;
binding.Security.Mode = BasicHttpSecurityMode.Transport;
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate;

client.ClientCredentials.ClientCertificate.Certificate = ...

您可以編輯證書以適合您的要求:)

服務客戶端文檔https://msdn.microsoft.com/zh-cn/library/mt185502.aspx

請參閱: https : //social.msdn.microsoft.com/Forums/sqlserver/en-US/f1b8ef52-8c3e-417c-94b9-ba2a545e9beb/uwp-app-making-soap-call-requirering-clientcredential?forum=wpdevelop

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM