Ejemplo n.º 1
0
 public override void OnReceivedSslError(Android.Webkit.WebView view, SslErrorHandler handler, SslError error)
 {
     if (FormsWebViewRenderer.IgnoreSslGlobally)
     {
         handler.Proceed();
     }
     else
     {
         handler.Cancel();
     }
 }
            public override void OnReceivedSslError(WebView view, SslErrorHandler handler, SslError error)
            {
                if (sslContinue == null)
                {
                    var certComparer = new SslCertificateEqualityComparer();
                    sslContinue = new HashSet <SslCertificate>(certComparer);
                    inProgress  = new Dictionary <SslCertificate, List <SslErrorHandler> >(certComparer);
                }

                List <SslErrorHandler> handlers;

                if (inProgress.TryGetValue(error.Certificate, out handlers))
                {
                    handlers.Add(handler);
                    return;
                }

                if (sslContinue.Contains(error.Certificate))
                {
                    handler.Proceed();
                    return;
                }

                inProgress[error.Certificate] = new List <SslErrorHandler>();

                AlertDialog.Builder builder = new AlertDialog.Builder(this.activity);
                builder.SetTitle("Security warning");
                builder.SetIcon(global::Android.Resource.Drawable.IcDialogAlert);
                builder.SetMessage("There are problems with the security certificate for this site.");

                builder.SetNegativeButton("Go back", (sender, args) =>
                {
                    UpdateInProgressHandlers(error.Certificate, h => h.Cancel());
                    handler.Cancel();
                });

                builder.SetPositiveButton("Continue", (sender, args) =>
                {
                    sslContinue.Add(error.Certificate);
                    UpdateInProgressHandlers(error.Certificate, h => h.Proceed());
                    handler.Proceed();
                });

                builder.Create().Show();
            }
        public override void OnReceivedSslError(Android.Webkit.WebView view, SslErrorHandler handler, SslError error)
        {
            if (Reference == null || !Reference.TryGetTarget(out FormsWebViewRenderer renderer))
            {
                return;
            }
            if (renderer.Element == null)
            {
                return;
            }

            if (FormsWebViewRenderer.IgnoreSSLGlobally)
            {
                handler.Proceed();
            }
            else
            {
                handler.Cancel();
                renderer.Element.Navigating = false;
            }
        }
Ejemplo n.º 4
0
 public override void OnReceivedSslError(WebView view, SslErrorHandler handler, SslError error)
 {
     Log.Info("Error", "Exception caught!");
     handler.Cancel();
 }
Ejemplo n.º 5
0
 public override void OnReceivedSslError(WebView view, SslErrorHandler handler, SslError error)
 {
     Logger.Error(Tag, "onReceivedSslError: error");
     handler.Cancel();
 }