0

I am trying to add a proxy, I need to do this multiple times during the application. I use the below code to assign the setting at the start.

CefSettings cfsettings = new CefSettings();
cfsettings.CefCommandLineArgs.Add("proxy-server", proxy.Key + ":" + proxy.Value);
cfsettings.UserAgent = "My/Custom/User-Agent-AndStuff";
Cef.Initialize(cfsettings);

As you can see I initialize the browser, that works fine for the first ever time, but what if I want to change the proxy in the middle of the application?

I tried running that code again to sort of try and "reinitiailize" the settings to change the proxy server but I received the following error when trying to do so:

System.Exception: 'Cef can only be initialized once. Use Cef.IsInitialized to guard against this exception.'

Using WinForms.

TEK
  • 1,265
  • 1
  • 15
  • 30
Garry Fox
  • 9
  • 3
  • 1
    Possible duplicate of [CefSharp 3 set proxy at Runtime](https://stackoverflow.com/questions/36095566/cefsharp-3-set-proxy-at-runtime) – TEK Aug 18 '17 at 20:54
  • 1
    How is that even relevant? I'm trying to set it in the middle of the application, not runtime. – Garry Fox Aug 18 '17 at 22:06
  • 1
    Runtime? What does "middle of the application" even mean if it doesn't mean runtime? If you want help, lose the attitude and explain yourself properly so it avoids ambiguity. – TEK Aug 18 '17 at 22:29

0 Answers0