cef cefsharp加载网页空白

屏蔽ssl验证即可

Browser.RequestHandler = new ExampleRequestHandler();
 public class ExampleRequestHandler : RequestHandler
        {
            protected override bool OnCertificateError(IWebBrowser chromiumWebBrowser, IBrowser browser, CefErrorCode errorCode, string requestUrl, ISslInfo sslInfo, IRequestCallback callback)
            {
                Task.Run(() =>
                {
                    if (!callback.IsDisposed)
                    {
                        using (callback)
                        {
                            //地址包含报表成分 跳过ssl验证
                            if (requestUrl.Contains("reportSystem"))
                            {
                                callback.Continue(true);//重点部分
                            }
                            else
                            {
                                callback.Continue(false);
                            }
                        }
                    }
                });
                return true;
            }
        }

[参考]
Cefsharp开发中遇到的问题

posted @ 2024-11-14 22:43  Hey,Coder!  阅读(34)  评论(0编辑  收藏  举报