An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
Hi @Jerry Bonetti ,
Thanks for reaching out.
I took a closer look at what you described. If your custom handler is initializing but OnReceivedSslError is never being called, that usually means one of two things: either Android isn’t actually seeing an SSL error, or your custom WebViewClient isn’t the one being used by the WebView.
The first thing I’d verify is whether the certificate is truly untrusted on the device/emulator. If the self-signed certificate has been installed or trusted through the Android network security configuration, the WebView won’t treat it as an error, and if there’s no SSL error, OnReceivedSslError will never fire. A quick way to confirm this is to browse to the same URL in Chrome on the device and see whether it shows a certificate warning.
If you do see a warning in Chrome but still don’t hit OnReceivedSslError in your app, the next likely cause is that your custom WebViewClient isn’t actually attached to the native Android WebView. In .NET MAUI (especially with .NET 10), it’s important to explicitly set the client inside the handler’s ConnectHandler method, for example:
- Override
ConnectHandler(Android.Webkit.WebView platformView) - Call
platformView.SetWebViewClient(new YourCustomClient())
Even if the handler itself is registered in MauiProgram, MAUI can still assign its own default client unless you explicitly replace it at the platform view level. That’s often the missing piece.
Also make sure you’re testing with an https:// endpoint and not http://localhost. If SSL isn’t actually being negotiated, there’s nothing for Android to validate.
Hope this helps! If my answer was helpful - kindly follow the instructions here so others with the same problem can benefit as well.