title: Xamarin.Forms Ignore SSL Errors Android (Self Signed)
body: <p><strong>Problem is urls with Self Signed SSL Certificates are being rejected by the <code>WebView</code> on Android resulting in a white screen.</strong> </p>
  
  <p>I understand this question has been <a href="https://stackoverflow.com/questions/28629989/ignore-ssl-certificate-errors-in-xamarin-forms-pcl">answered.</a> These solutions do not work. You can see by the comments it does not work for many others.  <code>ServicePointManager</code> will work for IOS and compile for Android but the callback will never be raised on Android resulting in the white <code>WebView</code>.</p>
  
  <p>In Xamarin.Forms I have my full page <code>WebView</code>.</p>
  
  <pre><code>    &lt;WebView x:Name="Browser" HeightRequest="1000" WidthRequest="1000"/&gt;
  </code></pre>
  
  <p>In my Android project <code>MainActivity.cs</code> I have tried the suggested <code>ServicePointManager</code> which does not work. Instead in my <code>OnCreate</code> of <code>MainActivity.cs</code> I problematically add a <code>AddInvalidWebClient</code>.</p>
  
  <pre><code>    private void AddInvalidWebClient()
      {
          WebView wb = new WebView(this);
          wb.SetWebViewClient(new InvalidWebViewClient());
          wb.LoadUrl("https://invalidcertificate.com");
          // Not required for Invalid certificate, but required for my site.
          WebSettings ws = wb.Settings;
          ws.JavaScriptEnabled = true;
          // Add our new wb.
          SetContentView(wb);
      }
  </code></pre>
  
  <p>My <code>InvalidWebViewCient</code> is very basic. It inherits standard <code>WebViewClient</code> and suppresses the SSL error.</p>
  
  <pre><code>    public class InvalidWebViewClient : WebViewClient
      {
          public override void OnReceivedSslError(WebView view, SslErrorHandler handler, SslError error)
          {
              handler.Proceed();
          }
      }
  </code></pre>
  
  <p><strong>Is there another/better way to ignore SSL Erros on <code>Xamarin.Forms</code> <code>WebView</code> for Android?</strong> <code>ServicePointManager</code> does not work and adding another <code>WebView</code> in my <code>MainActivity.cs</code> seems counter active (not to mention hacky) for <code>Xamarin.Forms</code>.</p>
  
  <p>P.S. I understand it's bad to suppress all SSL errors. Once I'm confident I have a solution I will build in a way to suppress them only for my certificates public key.</p>