------------吾亦無他,唯手熟爾,謙卑若愚,好學若饑-------------
本次記錄如何設定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);
}