2021-02-09 HTTP/2 request with client certificate sample code My sample code: 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081using System;using System.Collections.Generic;using System.IO;using System.Linq;using System.Net.Http;using System.Security.Cryptography.X509Certificates;using System.Text;using System.Threading.Tasks;namespace TestHTTP2{ class Program { static async Task Main(string[] args) { X509Certificate2 clientCert = GetClientCertificate(); Http2CustomHandler requestHandler = new Http2CustomHandler(); requestHandler.ClientCertificates.Add(clientCert); using (var httpClient = new HttpClient(requestHandler)) { //client.BaseAddress = new Uri(https://www.bing.com/); HttpResponseMessage response = await httpClient.GetAsync(@https://jackyclientcer21.azurewebsites.net/); if (response.IsSuccessStatusCode) { Console.WriteLine("HTTP2 is success!!"); } else { Console.WriteLine(response.StatusCode); Console.WriteLine(response.Content); } } Console.ReadLine(); } private static X509Certificate2 GetClientCertificate() { X509Store userCaStore = new X509Store(StoreName.My, StoreLocation.CurrentUser); try { //X509Store store = new X509Store(StoreName.My, StoreLocation.CurrentUser); userCaStore.Open(OpenFlags.ReadOnly); X509Certificate2 clientCertificate = null; foreach (X509Certificate2 certificate in userCaStore.Certificates) { if (certificate != null) { Console.WriteLine(certificate.Subject); Console.WriteLine(certificate.Thumbprint); clientCertificate = certificate; break; } } return clientCertificate; } catch { throw; } finally { userCaStore.Close(); } } } public class Http2CustomHandler : WinHttpHandler { protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) { request.Version = new Version("2.0"); return base.SendAsync(request, cancellationToken); } }} HTH. 2021-2-9 by Jacky Newer How to get a list of all the Programmatic Deployments Older HttpRequestMessage.CreateResponse causes stackoverflow when serializing JObject in Functions v3 runtime