0

Do we have any way to get HttpClientHandler to attach X509 certificate and hit a WebAPI in WPF Application's WebView2 control?

I have a specific scenario here with WPF application. I want to call WebAPI with X509Certificate attached in WebView2 control. Now, if it was HttpClient then I could have got HttpClientHandler to attach the certificate. How do I do this with WebView2 control. The reason here I want to do this with WebView2 control, because, the WebAPI validates certificate thumbprint and will redirect to a different webpage depending on scenario which needs to be rendered on WebView2.

NILESH
  • 55
  • 10
  • Did you try to handle the [CoreWebView2.ClientCertificateRequested](https://learn.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.core.corewebview2.clientcertificaterequested?WT.mc_id=WD-MVP-5001077) event? – mm8 Mar 22 '23 at 13:08
  • https://stackoverflow.com/questions/71139251/how-to-add-a-server-certificate-to-webview2 – Andy Mar 22 '23 at 17:52
  • CoreWebView2.ClientCertificateRequested exposes the certificates but you cannot load and attach X509. it only accepts CoreWebView2ClientCertificate. Is there any way to convert of use X509 over there? Also, I cannot add to Trusted root certificates due to permissions. – NILESH Mar 27 '23 at 10:10

0 Answers0