views:

163

answers:

2

Hello,

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 username/password, such as :

Skybound.Gecko.GeckoPreferences.User["network.proxy.user"] = (user); Skybound.Gecko.GeckoPreferences.User["network.proxy.password"] = (password);

But, nothing has worked so far. Can anyone help? I would really appreciate it!!!

I am using VB.net if that helps. Thanks!!

A: 

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?

ho1
A: 

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