Help With Proxy Username & Pass with GeckoFX?

拟墨画扇 提交于 2019-12-01 08:13:45

You probably need to set proxy type to 1. To detect proxy settings automatically, try this:

Uri website = new Uri("http://stackoverflow.com");
System.Net.IWebProxy defaultproxy = System.Net.WebRequest.GetSystemWebProxy();
Uri proxy = defaultproxy.GetProxy(website); //no actual connect is done

if (proxy.AbsoluteUri != website.AbsoluteUri) {
    Skybound.Gecko.GeckoPreferences.User["network.proxy.http"] = proxy.Host;
    Skybound.Gecko.GeckoPreferences.User["network.proxy.http_port"] = proxy.Port;
    Skybound.Gecko.GeckoPreferences.User["network.proxy.ssl"] = proxy.Host;
    Skybound.Gecko.GeckoPreferences.User["network.proxy.ssl_port"] = proxy.Port;
    Skybound.Gecko.GeckoPreferences.User["network.proxy.type"] = 1;
    //0 – Direct connection, no proxy. (Default)
    //1 – Manual proxy configuration.
    //2 – Proxy auto-configuration (PAC).
    //4 – Auto-detect proxy settings.
    //5 – Use system proxy settings (Default in Linux).     
}

You're trying to set them among the settings. You can access all available settings by typing about:config in the firefox addressbar, and there is no user or password setting there. I assume this is because the usernames and passwords needs to be stored securely. I think that if you leave them unset when you try to connect to the proxy it'll ask you for them and then store them somewhere secure, and it will then use that username and password automatically.

If you do need to store them manually, I'd suggest that it might be worth to look at the Password Manager, maybe GeckoFX supports some way of accessing that?

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