Created
June 6, 2014 20:03
-
-
Save sdurandeu/4234fe904cfea9e39ec8 to your computer and use it in GitHub Desktop.
Request with Client Certificate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| X509Store store = new X509Store(StoreName.My, StoreLocation.CurrentUser); | |
| store.Open(OpenFlags.OpenExistingOnly | OpenFlags.ReadOnly); | |
| var cert = store.Certificates.Find(X509FindType.FindByThumbprint, "ff9afddf408ccd62a5dc83aacc48f8432ab7c86c", false)[0]; | |
| var messageHandler = new WebRequestHandler(); | |
| messageHandler.ClientCertificates.Add(cert); | |
| messageHandler.ClientCertificateOptions = ClientCertificateOption.Manual; | |
| HttpClient httpClient = new HttpClient(messageHandler); | |
| var result = httpClient.GetAsync("https://clientcertificatetesting.azurewebsites.net/").Result; | |
| store.Close(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment