Exemplo n.º 1
0
 public bool OnCertificateError(IWebBrowser browserControl,
                                IBrowser browser,
                                CefErrorCode errorCode,
                                string requestUrl,
                                ISslInfo sslInfo,
                                IRequestCallback callback)
 {
     callback.Dispose();
     return(false);
 }
Exemplo n.º 2
0
        public OnCertificateErrorEventArgs(IWebBrowser browserControl, IBrowser browser, CefErrorCode errorCode, string requestUrl, ISslInfo sslInfo, IRequestCallback callback)
            : base(browserControl, browser)
        {
            ErrorCode  = errorCode;
            RequestUrl = requestUrl;
            SSLInfo    = sslInfo;
            Callback   = callback;

            ContinueAsync = false; // default
        }
Exemplo n.º 3
0
        bool IRequestHandler.OnCertificateError(IWebBrowser browserControl, IBrowser browser, CefErrorCode errorCode, string requestUrl, ISslInfo sslInfo, IRequestCallback callback)
        {
            //NOTE: When executing the callback in an async fashion need to check to see if it's disposed
            if (!callback.IsDisposed)
            {
                using (callback)
                {
                    //To allow certificate
                    //callback.Continue(true);
                    //return true;
                }
            }

            return false;
        }
Exemplo n.º 4
0
        bool IRequestHandler.OnCertificateError(IWebBrowser browserControl, IBrowser browser, CefErrorCode errorCode, string requestUrl, ISslInfo sslInfo, IRequestCallback callback)
        {
            try
            {
                //To allow certificate
                //callback.Continue(true);
                //return true;

                return false;
            }
            finally
            {
                callback.Dispose();
            }
        }
 bool IRequestHandler.OnCertificateError(IWebBrowser browserControl, IBrowser browser, CefErrorCode errorCode,
     string requestUrl, ISslInfo sslInfo, IRequestCallback callback) {
     //NOTE: If you do not wish to implement this method returning false is the default behaviour
     // We also suggest you explicitly Dispose of the callback as it wraps an unmanaged resource.
     //callback.Dispose();
     //return false;
     //NOTE: When executing the callback in an async fashion need to check to see if it's disposed
     if (!callback.IsDisposed) {
         using (callback) {
             //To allow certificate
             //callback.Continue(true);
             //return true;
         }
     }
     return false;
 }
 bool IRequestHandler.OnCertificateError(IWebBrowser browserControl, IBrowser browser, CefErrorCode errorCode,
                                         string requestUrl, ISslInfo sslInfo, IRequestCallback callback)
 {
     //NOTE: If you do not wish to implement this method returning false is the default behaviour
     // We also suggest you explicitly Dispose of the callback as it wraps an unmanaged resource.
     //callback.Dispose();
     //return false;
     //NOTE: When executing the callback in an async fashion need to check to see if it's disposed
     if (!callback.IsDisposed)
     {
         using (callback) {
             //To allow certificate
             //callback.Continue(true);
             //return true;
         }
     }
     return(false);
 }
Exemplo n.º 7
0
        public bool OnCertificateError(
            IWebBrowser browserControl,
            IBrowser browser,
            CefErrorCode errorCode,
            string requestUrl,
            ISslInfo sslInfo,
            IRequestCallback callback)
        {
            bool flag = false;

            if (this._handler != null)
            {
                flag = this._handler.OnCertificateError(browserControl, browser, errorCode, requestUrl, sslInfo, callback);
            }
            if (!callback.IsDisposed)
            {
                callback.Dispose();
            }
            return(flag);
        }
Exemplo n.º 8
0
 protected override bool OnCertificateError(IWebBrowser chromiumWebBrowser, IBrowser browser,
                                            CefErrorCode errorCode, string requestUrl, ISslInfo sslInfo,
                                            IRequestCallback callback)
 {
     callback.Continue(true);
     return(true);
 }
Exemplo n.º 9
0
 bool IRequestHandler.OnCertificateError(IWebBrowser browserControl, IBrowser browser, CefErrorCode errorCode,
                                         string requestUrl, ISslInfo sslInfo, IRequestCallback callback)
 {
     return(false);
 }
 bool IRequestHandler.OnCertificateError(IWebBrowser browserControl, IBrowser browser, CefErrorCode errorCode, string requestUrl, ISslInfo sslInfo, IRequestCallback callback)
 {
     callback.Dispose();
     return false;
 }
Exemplo n.º 11
0
 public bool OnCertificateError(IWebBrowser chromiumWebBrowser, IBrowser browser, CefErrorCode errorCode, string requestUrl, ISslInfo sslInfo, IRequestCallback callback) => _request.OnCertificateError(chromiumWebBrowser, browser, errorCode, requestUrl, sslInfo, callback);
Exemplo n.º 12
0
 public bool OnCertificateError(IWebBrowser browserControl, IBrowser browser, CefErrorCode errorCode, string requestUrl, ISslInfo sslInfo, IRequestCallback callback)
 {
     return(OnCertificateError(browserControl, browser, errorCode, requestUrl, sslInfo, callback));
 }
Exemplo n.º 13
0
 /// <summary>
 /// Called to handle requests for URLs with an invalid SSL certificate. Return true and call
 /// <see cref="IRequestCallback.Continue"/> either in this method or at a later time to continue or cancel the request.
 /// If CefSettings.IgnoreCertificateErrors is set all invalid certificates will be accepted without calling this method.
 /// </summary>
 /// <param name="chromiumWebBrowser">the ChromiumWebBrowser control.</param>
 /// <param name="browser">the browser object.</param>
 /// <param name="errorCode">the error code for this invalid certificate.</param>
 /// <param name="requestUrl">the url of the request for the invalid certificate.</param>
 /// <param name="sslInfo">ssl certificate information.</param>
 /// <param name="callback">Callback interface used for asynchronous continuation of url requests. If empty the error cannot be
 /// recovered from and the request will be canceled automatically.</param>
 /// <returns>
 /// Return false to cancel the request immediately. Return true and use <see cref="IRequestCallback"/> to execute in an async
 /// fashion.
 /// </returns>
 protected virtual bool OnCertificateError(IWebBrowser chromiumWebBrowser, IBrowser browser, CefErrorCode errorCode, string requestUrl,
                                           ISslInfo sslInfo, IRequestCallback callback)
 {
     callback.Dispose();
     return(false);
 }
Exemplo n.º 14
0
 public bool OnCertificateError(IWebBrowser chromiumWebBrowser, IBrowser browser, CefErrorCode errorCode, string requestUrl, ISslInfo sslInfo, IRequestCallback callback)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 15
0
 public bool OnCertificateError(IWebBrowser browserControl, IBrowser browser, CefErrorCode errorCode, string requestUrl, ISslInfo sslInfo, IRequestCallback callback) =>
 true;
Exemplo n.º 16
0
        protected override bool OnCertificateError(IWebBrowser chromiumWebBrowser, IBrowser browser, CefErrorCode errorCode, string requestUrl, ISslInfo sslInfo, IRequestCallback callback)
        {
            Task.Run(() =>
            {
                if (!callback.IsDisposed)
                {
                    using (callback)
                    {
                        // Allow the expired certificate from graalonline
                        if (requestUrl.ToLower().Contains("https://classic.graalonline.com"))
                        {
                            callback.Continue(true);
                        }
                        else if (requestUrl.ToLower().Contains("https://era.graalonline.com"))
                        {
                            callback.Continue(true);
                        }
                        else if (requestUrl.ToLower().Contains("https://zone.graalonline.com"))
                        {
                            callback.Continue(true);
                        }
                        else if (requestUrl.ToLower().Contains("https://olwest.graalonline.com"))
                        {
                            callback.Continue(true);
                        }
                        else
                        {
                            callback.Continue(false);
                        }
                    }
                }
            });

            return(true);
        }
Exemplo n.º 17
0
        bool IRequestHandler.OnCertificateError(IWebBrowser browserControl, IBrowser browser, CefErrorCode errorCode, string requestUrl, ISslInfo sslInfo,
                                                IRequestCallback callback)
        {
            if (!callback.IsDisposed)
            {
                callback.Dispose();
            }

            Logging.Warning(requestUrl);
            return(false);
        }
Exemplo n.º 18
0
 bool IRequestHandler.OnCertificateError(IWebBrowser browserControl, IBrowser browser, CefErrorCode errorCode, string requestUrl, ISslInfo sslInfo, IRequestCallback callback)
 {
     // We shouldn't hit this, since IgnoreCertificateErrors is true
     return true;
 }
 //调用该方法来处理SSL证书无效的URL请求。
 //返回true,并在本方法中或在以后调用Continue(Boolean)来继续或取消请求。
 //如果CefSettings.IgnoreCertificateErrors被设置,所有无效证书将被接受,而无需调用本方法。
 // IRequestCallback 用于异步延续url请求的回调接口。
 protected override bool OnCertificateError(IWebBrowser chromiumWebBrowser, IBrowser browser, CefErrorCode errorCode, string requestUrl, ISslInfo sslInfo, IRequestCallback callback)
 {
     // false 立即取消请求
     // true 使用IRequestCallback 以异步方式执行
     return(true);
 }
Exemplo n.º 20
0
        bool IRequestHandler.OnCertificateError(IWebBrowser browserControl, IBrowser browser, CefErrorCode errorCode, string requestUrl, ISslInfo sslInfo, IRequestCallback callback)
        {
            try
            {
                //To allow certificate
                //callback.Continue(true);
                //return true;

                return(false);
            }
            finally
            {
                callback.Dispose();
            }
        }
Exemplo n.º 21
0
 public bool OnCertificateError(IWebBrowser browserControl, IBrowser browser, CefErrorCode errorCode, string requestUrl, ISslInfo sslInfo, IRequestCallback callback)
 {
     return false;
 }
Exemplo n.º 22
0
        bool IRequestHandler.OnCertificateError(IWebBrowser browserControl, IBrowser browser, CefErrorCode errorCode, string requestUrl, ISslInfo sslInfo, IRequestCallback callback)
        {
            var args = new OnCertificateErrorEventArgs(browserControl, browser, errorCode, requestUrl, sslInfo, callback);

            OnCertificateErrorEvent?.Invoke(this, args);

            EnsureCallbackDisposal(callback);
            return(args.ContinueAsync);
        }
Exemplo n.º 23
0
        protected override bool OnCertificateError(IWebBrowser chromiumWebBrowser, IBrowser browser, CefErrorCode errorCode, string requestUrl, ISslInfo sslInfo, IRequestCallback callback)
        {
            var args = new OnCertificateErrorEventArgs(chromiumWebBrowser, browser, errorCode, requestUrl, sslInfo, callback);

            OnCertificateErrorEvent?.Invoke(this, args);

            EnsureCallbackDisposal(callback);
            return(args.ContinueAsync);
        }
Exemplo n.º 24
0
            protected override bool OnCertificateError(IWebBrowser chromiumWebBrowser, IBrowser browser, CefErrorCode errorCode, string requestUrl, ISslInfo sslInfo, IRequestCallback callback)
            {
                DialogResult dialogResult = MessageBox.Show($"Zertifikatsfehler (ErrorCode: {(int)errorCode} {errorCode}).\nMöchten Sie trotzdem fortfahren?", "Zertifikatsfehler", MessageBoxButtons.YesNo);
                bool         confirm      = true;

                if (dialogResult == DialogResult.No)
                {
                    confirm = false;
                }
                callback.Continue(confirm);
                return(true);
            }
Exemplo n.º 25
0
            public bool OnCertificateError(IWebBrowser browserControl, IBrowser browser, CefErrorCode errorCode, string requestUrl, ISslInfo sslInfo, IRequestCallback callback)
            {
                if (!parent.AllowInsecureCerts)
                {
                    return false;
                }

                callback.Continue(true);
                return true;
            }
        bool IRequestHandler.OnCertificateError(IWebBrowser browserControl, IBrowser browser, CefErrorCode errorCode, string requestUrl, ISslInfo sslInfo, IRequestCallback callback)
        {
            if (!callback.IsDisposed)
            {
                using (callback)
                {
                    //To allow certificate
                    //callback.Continue(true);
                    //return true;
                }
            }

            return(false);
        }
Exemplo n.º 27
0
 /// <inheritdoc/>
 bool IRequestHandler.OnCertificateError(IWebBrowser chromiumWebBrowser, IBrowser browser, CefErrorCode errorCode, string requestUrl,
                                         ISslInfo sslInfo, IRequestCallback callback)
 {
     return(OnCertificateError(chromiumWebBrowser, browser, errorCode, requestUrl, sslInfo, callback));
 }
Exemplo n.º 28
0
        public bool OnCertificateError(IWebBrowser browserControl, IBrowser browser, CefErrorCode errorCode, string requestUrl, ISslInfo sslInfo, IRequestCallback callback) {
            if (!callback.IsDisposed) {
                callback.Dispose();
            }

            Logging.Warning(requestUrl);
            return false;
        }
Exemplo n.º 29
0
 bool IRequestHandler.OnCertificateError(IWebBrowser browserControl, IBrowser browser, CefErrorCode errorCode, string requestUrl, ISslInfo sslInfo, IRequestCallback callback)
 {
     // We shouldn't hit this, since IgnoreCertificateErrors is true
     return(true);
 }
Exemplo n.º 30
0
        protected override bool OnCertificateError(IWebBrowser chromiumWebBrowser, IBrowser browser, CefErrorCode errorCode, string requestUrl, ISslInfo sslInfo, IRequestCallback callback)
        {
            Task.Run(() =>
            {
                if (!callback.IsDisposed)
                {
                    using (callback)
                    {
                        callback.Continue(true);
                    }
                }
            });

            return(true);
        }
Exemplo n.º 31
0
        public bool OnCertificateError(IWebBrowser browserControl, IBrowser browser, CefErrorCode errorCode, string requestUrl, ISslInfo sslInfo, IRequestCallback callback)
        {
            // NOTE: When executing the callback in an async fashion need to check to see if it's disposed
            if (!callback.IsDisposed)
            {
                using (callback)
                {
                    // To allow certificate
                    // callback.Continue(true);
                    // return true;
                }
            }

            return(false);
        }
Exemplo n.º 32
0
 protected override bool OnCertificateError(IWebBrowser chromiumWebBrowser, IBrowser browser, CefErrorCode errorCode, string requestUrl, ISslInfo sslInfo, IRequestCallback callback)
 {
     using (callback) {
         if (OwnerWebView.IgnoreCertificateErrors)
         {
             callback.Continue(true);
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 33
0
 public bool OnCertificateError(IWebBrowser chromiumWebBrowser, IBrowser browser, CefErrorCode errorCode, string requestUrl, ISslInfo sslInfo, IRequestCallback callback)
 {
     return(false);
 }
Exemplo n.º 34
0
        protected override bool OnCertificateError(IWebBrowser chromiumWebBrowser, IBrowser browser, CefErrorCode errorCode, string requestUrl, ISslInfo sslInfo, IRequestCallback callback)
        {
            //NOTE: We also suggest you wrap callback in a using statement or explicitly execute callback.Dispose as callback wraps an unmanaged resource.

            //Example #1
            //Return true and call IRequestCallback.Continue() at a later time to continue or cancel the request.
            //In this instance we'll use a Task, typically you'd invoke a call to the UI Thread and display a Dialog to the user
            //You can cast the IWebBrowser param to ChromiumWebBrowser to easily access
            //control, from there you can invoke onto the UI thread, should be in an async fashion
            Task.Run(() =>
            {
                //NOTE: When executing the callback in an async fashion need to check to see if it's disposed
                if (!callback.IsDisposed)
                {
                    using (callback)
                    {
                        //We'll allow the expired certificate from badssl.com
                        if (requestUrl.ToLower().Contains("https://expired.badssl.com/"))
                        {
                            callback.Continue(true);
                        }
                        else
                        {
                            callback.Continue(false);
                        }
                    }
                }
            });

            return(true);

            //Example #2
            //Execute the callback and return true to immediately allow the invalid certificate
            //callback.Continue(true); //Callback will Dispose it's self once exeucted
            //return true;

            //Example #3
            //Return false for the default behaviour (cancel request immediately)
            //callback.Dispose(); //Dispose of callback
            //return false;
        }
Exemplo n.º 35
0
 public bool OnCertificateError(IWebBrowser browserControl, IBrowser browser, CefErrorCode errorCode, string requestUrl, ISslInfo sslInfo, IRequestCallback callback)
 {
     //throw new NotImplementedException();
     return(false);
 }
Exemplo n.º 36
0
 bool IRequestHandler.OnCertificateError(IWebBrowser browserControl, IBrowser browser, CefErrorCode errorCode, string requestUrl, ISslInfo sslInfo, IRequestCallback callback)
 {
     if (this.OwnerWebView.IgnoreCertificateErrors)
     {
         callback.Continue(true);
         return(true);
     }
     return(false);
 }