问题
I can't seem to find a way to use proxies with username and password (http/socks4). Any input would be great :)
I 'm using the .net wrapper, but I guess that does not make any difference.
Thanks,
John
回答1:
You need to handle the WebControl LoginRequest
Event, that is if you
want to specify the user name an password in code
private void webcontrol_LoginRequest (object sender, LoginRequestEventArgs e)
{
e.Username = "username";
e.Password = "password";
e.Handled = EventHandling.Modal;
e.Cancel = false;
}
Test:
WebPreferences prefs = new WebPreferences() { ProxyConfig = "xxx.xxx.xxx.xxx:port" };
session = WebCore.CreateWebSession(prefs);
webcontrol = new WebControl() { WebSession = session };
webcontrol.LoginRequest += new LoginRequestEventHandler(webcontrol_LoginRequest);
- if you don't want to handle the event then you'll get a dialoge that you can enter the credintials in.
来源:https://stackoverflow.com/questions/11022304/is-there-any-way-to-use-authentication-with-proxy-in-awesomium