Iva*_*ono 5 c# visual-studio-2012 chromium-embedded cefsharp
目前,我将缓存路径设置如下:
CefSettings settings = new CefSettings();
settings.CachePath = mycachePath;
Cef.Initialize(settings);
var browser = new ChromiumWebBrowser(myUrl);
Run Code Online (Sandbox Code Playgroud)
以上作品。
但是,我需要同时使用2个不同的帐户登录一个网站,但是它使用相同的cookie容器。因此,如果我先登录一个帐户,然后再登录另一个帐户,则第一个帐户将被覆盖。
每个浏览器是否可能都有一个缓存路径?
还是有更好的方法来处理这种情况?
看起来您正在使用CefSharp?如果是这样,查看代码,您似乎想使用空的CachePath创建浏览器:
/// <summary>
/// Returns the cache path for this object. If empty an "incognito mode"
/// in-memory cache is being used.
/// </summary>
string CachePath { get; }
Run Code Online (Sandbox Code Playgroud)
看看他们的样本(我假设没有窗口),这看起来会大致得到你想要的:
var browserSettings = new BrowserSettings();
var requestContextSettings = new RequestContextSettings { CachePath = "" };
using(var requestContext = new RequestContext(requestContextSettings))
using (var browser = new ChromiumWebBrowser(TestUrl, browserSettings, requestContext))
{
...
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1865 次 |
| 最近记录: |