zoukankan      html  css  js  c++  java
  • C#:设置CefSharp的一些参数,比如忽略安全证书

    ------------吾亦无他,唯手熟尔,谦卑若愚,好学若饥-------------

    本次记录如何设置CefSharp忽略安全证书,以及他的一些其他配置

    参考网址

    https://peter.sh/experiments/chromium-command-line-switches/

    这个网站记录了CefSharp所有可以设置的配置

    http://www.codebye.com/cefsharp-help-2-config-manage.html

    这个网站记录了如何具体设置,不过第二个网站在刚才测试中好像没能打开,我简单说一下

    具体设置

    我在第一个参考网站中找到证书,他有俩个,我不知道哪个起作用,我就都配置了

                //安全证书
                
                settings.CefCommandLineArgs.Add("--ignore-urlfetcher-cert-requests", "1");
                settings.CefCommandLineArgs.Add("--ignore-certificate-errors", "1");

    这是flash的配置

                //flash
                settings.CefCommandLineArgs.Add("ppapi-flash-path", AppDomain.CurrentDomain.BaseDirectory + "\Plugins\pepflash\pepflashplayer.dll");

    具体放入的位置参考我上篇博客的InitializeCefSharp方法里,我写个Demo

            /// <summary>
            /// 解决anycpu不能兼容
            /// </summary>
            [MethodImpl(MethodImplOptions.NoInlining)]
            private static void InitializeCefSharp()
            {
                var settings = new CefSettings();
    
                // Set BrowserSubProcessPath based on app bitness at runtime
                settings.BrowserSubprocessPath = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase,
                                                       Environment.Is64BitProcess ? "x64" : "x86",
                                                       "CefSharp.BrowserSubprocess.exe");
                //安全证书
                
                settings.CefCommandLineArgs.Add("--ignore-urlfetcher-cert-requests", "1");
                settings.CefCommandLineArgs.Add("--ignore-certificate-errors", "1");
                //settings.CefCommandLineArgs.Add("allow-http-background-page", "1");
                //settings.CefCommandLineArgs.Add("allow-insecure-localhost","1");
                //settings.CefCommandLineArgs.Add("allow-http-screen-", "1");
                
                //settings.CefCommandLineArgs.Add("reduce-security-for-testing", "1");
                
       
                //flash
                settings.CefCommandLineArgs.Add("ppapi-flash-path", AppDomain.CurrentDomain.BaseDirectory + "\Plugins\pepflash\pepflashplayer.dll");
    
                // Make sure you set performDependencyCheck false
                Cef.Initialize(settings, performDependencyCheck: false, browserProcessHandler: null);
            }
  • 相关阅读:
    正则表达式 ^
    jQuery的加法运算,val()获取的结果相加变成了字符串连接。
    mssql 取数据指定条数(例:100-200条的数据)
    css样式大全(整理版)
    50个技巧提高你的PHP网站程序执行效率
    ASP版_阿里大于短信API Demo
    FusionCharts的使用方法(超详细)
    FusionCharts参数说明 (中文)
    web服务器选择Apache还是Nginx
    反向代理服务器的工作原理
  • 原文地址:https://www.cnblogs.com/DawnCHENXI/p/9289020.html
Copyright © 2011-2022 走看看