Is there any way to use authentication with proxy

2019-04-10 05:34发布

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

标签: awesomium
1条回答
小情绪 Triste *
2楼-- · 2019-04-10 06:11

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.
查看更多
登录 后发表回答