Is there any way to use authentication with proxy in Awesomium?

ぐ巨炮叔叔 提交于 2019-12-06 04:13:09

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!