Help With Proxy Username & Pass with GeckoFX?

前端 未结 2 1855
夕颜
夕颜 2021-01-14 03:30

I am trying to set the proxy username and password. I saw this posting (http://geckofx.org/viewtopic.php?id=832) and I thought it might be a similar setting for the usernam

2条回答
  •  耶瑟儿~
    2021-01-14 04:24

    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).     
    }
    

提交回复
热议问题