0

Now, I already know how to modify the network proxy. But i want to disable it, not modify it.

Cef.UIThreadTaskFactory.StartNew(delegate {
      var rc = chromeBrowser.GetBrowser().GetHost().RequestContext;
      var v = new Dictionary<string, object>();
      v["mode"] = "fixed_servers";
      v["server"] = "scheme://server:port;
      string error;
      bool success = rc.SetPreference("proxy", v, out error);                
    });   

I want to implement it like

var cefSettings = new CefSharp.CefSettings();
cefSettings.CefCommandLineArgs.Add("no-proxy-server","1");

but, I want to disable proxy at runtime

amaitland
  • 4,073
  • 3
  • 25
  • 63
Mr.Query
  • 3
  • 3

1 Answers1

2

1) You must not use CefCommandLineArgs that setting proxy. You must set proxy how you written above.You must set proxy behind Cef.Initialize() how you written above.

2)Replace mode to "DIRECT" - it disabled connection with proxy.

v["mode"] = "direct";

3) You can check actual connection information if you will loading page "chrome://net-internals#proxy"

123_123
  • 251
  • 1
  • 4
  • Yes, I tested that I can really disable connection with proxy. thank you very much! – Mr.Query May 18 '17 at 07:35
  • Sorry, because the english is not good, I am not familiar with this website. I forgot to accept the answer before, and I apologize to you.I am sorry – Mr.Query Mar 20 '19 at 00:55