Using different proxy for each GeckoFx Instances
Asked Answered
C

1

11

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;
Cynar answered 11/11, 2014 at 7:42 Comment(0)
T
-1

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

Tearle answered 8/9, 2018 at 20:46 Comment(4)
I am not. I have 4 standard gecko browsers and trying to set different proxies to each one, constantly. Do i need to recreate every browser before use it? I am sorry, i can not share any code here since it is not my thread. I just found it and added the bounty since i have the same issueConfraternity
@Confraternity you should create a new question with the relative details and reference back to this bounty, that way you get to state your specific problem.Lepine
@Lepine there is no reason. I have exactly the same problem. And the same code in a loop...Confraternity
@Confraternity ok then. it was just a suggestion in case you wanted to add more details which would have been easier to notice than in a comments thread.Lepine

© 2022 - 2024 — McMap. All rights reserved.