Welcome Guest Search | Active Topics | Sign In | Register

ThreadRunner with proxy Options
Dragos
Posted: Tuesday, April 4, 2017 8:40:04 AM
Rank: Advanced Member
Groups: Member

Joined: 6/3/2016
Posts: 32
Hello,

What is the correct model to use the proxy into a ThreadRunner project?

Here is what I am trying, but for some reason Fiddler is not getting this request. Am I missing something?

Also, I tried to set the Proxy property of the ThreadRunner's Engine, but it was empty and the property is read-only.

Quote:

BrowserOptions bo = new BrowserOptions();
bo.AllowJavaScript = true;
bo.DefaultEncoding = Encoding.UTF8;
bo.EnableWebSecurity = false;
bo.LoadImages = false;
EO.WebBrowser.Runtime.SetDefaultBrowserOptions(bo);

#if DEBUG
EO.WebBrowser.Runtime.Proxy = new ProxyInfo(ProxyType.HTTP, "localhost", 8888);
#endif

ThreadRunner threadRunner = null;
WebView webView = null;
try
{
threadRunner = new ThreadRunner();
// threadRunner.Engine.Options.Proxy = new ProxyInfo(ProxyType.HTTP, "localhost", 8888);

webView = threadRunner.CreateWebView();

threadRunner.Send(() => {
webView.LoadUrlAndWait("http://www.google.com/");
});
}
catch (Exception ex)
{
Logger.Instance.LogException(ex, "Failed big time!");
}
finally
{
Logger.Instance.Debug("Out of scope!");

if (null != webView)
{
webView.Destroy();
webView = null;
}

if (null != threadRunner)
{
threadRunner.Dispose();
threadRunner = null;
}
}
eo_support
Posted: Tuesday, April 4, 2017 12:23:03 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,083
Hi,

You can use:

Code: C#
//Setting proxy settings for the default engine
EO.WebEngine.Engine.Default.Options = new ProxyInfo(....);


Make sure you call this before you create any WebView/ThreadRunner.

Thanks!
Dragos
Posted: Tuesday, April 4, 2017 6:15:40 PM
Rank: Advanced Member
Groups: Member

Joined: 6/3/2016
Posts: 32
It works like this, thanks. What's the difference then between EO.WebBrowser.Runtime.Proxy and EO.WebEngine.Engine.Default.Options.Proxy ?
eo_support
Posted: Tuesday, April 4, 2017 6:30:13 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,083
They are slightly different. EO.WebBrowser.Runtime.Proxy sets EngineOptions.Default value, which is used when an Engine is first created. So if you set EO.WebBrowser.Runtime.Proxy first, then access EO.WebEngine.Engine.Default.Options.Proxy, you will see the value being set. However the opposite is not true. To avoid confusion, we recommend you always use only one set of interface, either EO.WebBrowser.Runtime, or EO.WebEngine.Engine.Default.Options. Used alone, they have the same effects when you only use default engine. However if you use both together then it can create subtle issues that are hard to troubleshoot.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.