Could anyone help me on how to change the proxy settings dynamically in cef using Chromiumfx wrapper?
I able to change the proxy settings using commandline arguments at the time of initialization which is not useful for my current case.
I tried to change the preferences in the RequestContext like below.
- Code: Select all
var browser = new ChromiumWebBrowser();
var cfxRequestContext = browser.BrowserHost.RequestContext;
var cfxProxyValue = CfxValue.Create();
var cfxMode = CfxValue.Create();
var cfxServer = CfxValue.Create();
var cfxDictionaryValue = CfxDictionaryValue.Create();
cfxServer.SetString("URL:PORT");
cfxDictionaryValue.SetValue("mode", cfxMode);
cfxDictionaryValue.SetValue("server", cfxServer);
cfxProxyValue.SetDictionary(cfxDictionaryValue);
//Calling this on the UI thread
browser.InvokeOnUiThread(() =>
{
cfxRequestContext.SetPreference("proxy", cfxProxyValue, out var errorOut);
});
It is not setting the values and not throwing any error; errorOut value coming null.
Referring to the link,https://bitbucket.org/chromiumembedded/cef/issues/1709/allow-configuration-of-preferences-during, I understand that proxy settings can be changed during runtime in cef, but couldn't able to find how to a do it using chromiumfx.
I have tried it similar to viewtopic.php?f=6&t=15724 but no luck.
Any help would be greatly appreciated.
Thanks,
Raj.