2014-03-26 38 views
1

我正嘗試使用來自.net應用程序的客戶端證書對網站進行身份驗證。嘗試使用客戶端證書進行身份驗證時出現401.2錯誤

使用相同的證書,我可以使用chrome和IE訪問該網站。在同一臺機器上,我得到錯誤狀態代碼401.2。

這是我使用的代碼:

X509Certificate2 cert2 = new X509Certificate2(x509Cert); 
cert2.PrivateKey = algorithm; 

if (cert2.Verify() && cert2.HasPrivateKey) 
{ 
    WebRequestHandler handler = new WebRequestHandler(); 
    handler.ClientCertificates.Add(cert2); 
    HttpClient client = new HttpClient(handler); 

    string result = await client.GetStringAsync("https://localhost:8443/"); 
} 

編輯:

現在我已經嘗試提取了從瀏覽器證書存儲使用相同的證書,但我仍然得到同樣的錯誤,並且我已經切換到使用舊的WebClient,再次出現同樣的錯誤。

任何線索將不勝感激!

感謝

羅斯

回答

相關問題