Welcome Guest Search | Active Topics | Sign In | Register

How to use Proxy properly? Options
eve
Posted: Saturday, October 27, 2018 2:26:49 AM
Rank: Newbie
Groups: Member

Joined: 10/27/2018
Posts: 2
Hi, hope to get some help here. No matter what I do, I just can't make the request use the proxy. I can always see the traffic on localhost with fiddler.

Here is the constructor:
Quote:
public JsBrowser()
{
_engine = Engine.Create(_indentifier);
_engine.Options.CachePath = _indentifier;
_engine.Start();
_threadRunner = new ThreadRunner(_indentifier, _engine);
_webView = _threadRunner.CreateWebView();
}


And here is the method:
Quote:
public Tuple<bool, string> Dummy(WebProxy proxy)
{
var output = "";
bool valid = false;

if (proxy == null)
_engine.Options.Proxy = null;
else
{
ProxyInfo eoProxy = null;

if (proxy.Credentials != null)
{
var cr = proxy.Credentials as NetworkCredential;
eoProxy = new ProxyInfo(ProxyType.HTTP, proxy.Address.Host, proxy.Address.Port, cr.UserName, cr.Password);
}
else
eoProxy = new ProxyInfo(ProxyType.HTTP, proxy.Address.Host, proxy.Address.Port);
_engine.Options.Proxy = eoProxy;
}

_webView.CustomUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36";
_threadRunner.Send(() =>
{
Request request = new Request("https://www.google.com");
_webView.LoadRequestAndWait(request);
output = _webView.EvalScript("document.cookie").ToString();
});

return new Tuple<bool, string>(valid, output);
}


I even tried to re-create the engine or webview, but no help ...
eo_support
Posted: Sunday, October 28, 2018 5:13:27 PM
Rank: Administration
Groups: Administration

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

The Proxy must be set before the Engine has been created (before you call Engine.Start) and it can not be changed while the Engine is running.

Thanks!


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.