Share cache on browser?

I am currently setting the caching path as follows:

CefSettings settings = new CefSettings();
settings.CachePath = mycachePath;

Cef.Initialize(settings);

var browser = new ChromiumWebBrowser(myUrl);

The above work.

However, I need to log in to a site with two different accounts at the same time, but it uses the same cookie container. Therefore, if I log in with one account and then another, the first account is overridden.

Is it possible to have a caching path for each browser?

Or is there a better way to handle this situation?

+4
source share
1 answer

, 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; }

( ), , , :

var browserSettings = new BrowserSettings();
var requestContextSettings = new RequestContextSettings { CachePath = "" };

using(var requestContext = new RequestContext(requestContextSettings))
using (var browser = new ChromiumWebBrowser(TestUrl, browserSettings, requestContext))
{
    ...
}
+4

Source: https://habr.com/ru/post/1622368/


All Articles