如何在 C# .NET 中设置特定 Internet Explorer 8 实例的代理设置?
我想设置特定 Internet Explorer 8 实例的代理设置。这是我的代码:
static Process RunNewIE8Instance(string proxySettings)
{
ProcessStartInfo IEStartInfo = new ProcessStartInfo();
IEStartInfo.FileName = "IExplore.exe";
IEStartInfo.Arguments = " -nomerge -private ";
Process IEProcess = Process.Start(IEStartInfo);
// Here is the problem:
SetProxySettingsOfAProcess(IEProcess, proxySettings);
return IEProcess;
}
static void SetProxySettingsOfAProcess(Process IEProcess, string proxySettings)
{
/* I don't know how to do this,
* I tried everything, the most "successful" solution was with the registry..
* But I don't want machine-wide settings, I want to set settings only for the wininet instance of IEProcess
* The browser is used for testing, and I need to be able to spawn multiple Internet Explorer 8 instances with multiple proxy settings, one proxy for each instance.
*/
}
目的是让沙箱化的 Internet Explorer 8 实例具有自己的代理设置和 cookie JAR(cookie JAR 部分已使用 -private -nomerge
参数完成)。
I would like to set proxy settings of a specific Internet Explorer 8 instance. Here is my code:
static Process RunNewIE8Instance(string proxySettings)
{
ProcessStartInfo IEStartInfo = new ProcessStartInfo();
IEStartInfo.FileName = "IExplore.exe";
IEStartInfo.Arguments = " -nomerge -private ";
Process IEProcess = Process.Start(IEStartInfo);
// Here is the problem:
SetProxySettingsOfAProcess(IEProcess, proxySettings);
return IEProcess;
}
static void SetProxySettingsOfAProcess(Process IEProcess, string proxySettings)
{
/* I don't know how to do this,
* I tried everything, the most "successful" solution was with the registry..
* But I don't want machine-wide settings, I want to set settings only for the wininet instance of IEProcess
* The browser is used for testing, and I need to be able to spawn multiple Internet Explorer 8 instances with multiple proxy settings, one proxy for each instance.
*/
}
The purpose is to have sandboxed Internet Explorer 8 instances with their own proxy settings and cookie JAR (the cookie JAR part is already done with the -private -nomerge
parameters).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论