Using different proxy for each GeckoFx Instances

1.7k views Asked by At

I'm Using Geckfx18.0 and xulrunner18.01. Since Geckofx share cookie and user preferences with others instance so I try to create a new profile directory to make them have unique setting but it seems to be no use. here is my code. Is there any problem with my code?

String profileDir = port.ToString();
string directory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), Path.Combine("Geckofx", profileDir));
this.Text = directory.ToString();

if (!Directory.Exists(directory))
    Directory.CreateDirectory(directory);

Gecko.Xpcom.ProfileDirectory = directory;
GeckoPreferences.User["network.proxy.type"] = 1;
GeckoPreferences.User["network.proxy.socks"] = "127.0.0.1";
GeckoPreferences.User["network.proxy.socks_port"] = port;
GeckoPreferences.User["network.proxy.socks_version"] = 5;
GeckoPreferences.User["general.useragent.override"] = ua;
1

There are 1 answers

4
Parrish Husband On

Are you initializing the instance of Gecko before setting the ProfileDirectory?

Note that the XpCom.ProfileDirectory is a static property, so if you're trying to start each instance, keep in mind you may be undoing the path you set previously.

Additionally, rather than settings the preferences in code, you save your user preferences out to a file via GeckoPreferences.Save(). Then you can load them back in to support diferent users via GeckoPreferences.Load().