gpt4 book ai didi

c# - 如何让 Gecko 在每个实例中使用单独的 CookieContainer?

转载 作者:行者123 更新时间:2023-11-30 17:03:47 28 4
gpt4 key购买 nike

由于 .Net 中的 GeckoWebBrowser 与所有其他 GeckoWebBrowsers 实例共享 cookie,我希望 GeckoWebBrowser 拥有自己的 cookie 容器,该容器不共享之前在其他 GeckoWebBrowsers 或其他实例中创建的任何 cookie。

例如,当我创建一个 GeckoWebBrowser 时,它不应该有任何 cookie。当我运行 2 个 GeckoWebBrowser 实例时,它们有自己的 cookie 容器,并且不会彼此共享或冲突 cookie。

这怎么可能?

最佳答案

您可以更改 ProfileDirectory,它将保留 cookie 的唯一副本(以及所有其他用户设置):

string profileDir = "UniqueIdentifier";
string directory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), Path.Combine("Geckofx", profileDir));
if (!Directory.Exists(directory))
Directory.CreateDirectory(directory);
Gecko.Xpcom.ProfileDirectory = directory;

关于c# - 如何让 Gecko 在每个实例中使用单独的 CookieContainer?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18212262/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com