如何在 C# .NET 中设置特定 Internet Explorer 8 实例的代理设置?

发布于 2024-11-24 03:09:09 字数 1058 浏览 1 评论 0原文

我想设置特定 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文