I am following same step, but it give us 401 error.
Hardik Patel
1

Assuming your ceritificate is installed on personal certifcate store.

X509Store userCaStore = new X509Store(StoreName.My, StoreLocation.CurrentUser);

userCaStore.Open(OpenFlags.ReadOnly);

X509Certificate2Collection certificatesInStore = userCaStore.Certificates;

X509Certificate2Collection findResult = certificatesInStore.Find(X509FindType.FindBySubjectName, “localtestclientcert”, true);

X509Certificate2 clientCertificate = null;

if (findResult.Count == 1)

{

WebRequestHandler requestHandler = new WebRequestHandler();

requestHandler.ClientCertificates.Add(clientCertificate);

HttpClient client = new HttpClient(requestHandler)

{

BaseAddress = new Uri(“http://localhost:84000/")

};

HttpResponseMessage response = client.GetAsync(“customers”).Result;

response.EnsureSuccessStatusCode();

string responseContent = response.Content.ReadAsStringAsync().Result;

Console.WriteLine(responseContent);

}

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.