Note: Advice in this article will only work for DotNetBrowser 1.
See the corresponding article for DotNetBrowser 2 here.

The persistent cache is stored in the Browser data directory in Cache folder. By default all Browsers use predefined data directory. You can find out where this directory is located using the BrowserPreferences.GetDefaultChromiumDir() method.

So, if Browser A and B have the same data directory, then they will access the cache of each other.

If you need to configure each Browser to use unique cache storage which is not accessible for other Browser instances, you need to provide unique user data directory for each Browser instance. The user data directory path can be provided via configured BrowserContext object that must be passed into the BrowserFactory.Create(BrowserContext) factory method.

The following code demonstrates how to create two Browser instances that don't share cache:


BrowserContextParams params1= new BrowserContextParams("C:\\my-data1");
BrowserContext context1 = new BrowserContext(params1);
Browser browser1 = BrowserFactory.Create(context1);

BrowserContextParams params2= new BrowserContextParams("C:\\my-data2");
BrowserContext context2 = new BrowserContext(params2);
Browser browser2 = BrowserFactory.Create(context2);</code>


Dim params1 As BrowserContextParams = New BrowserContextParams("C:\my-data1")
Dim context1 As BrowserContext = New BrowserContext(params1)
Dim browser1 As Browser = BrowserFactory.Create(context1)

Dim params2 As BrowserContextParams = New BrowserContextParams("C:\my-data2")
Dim context2 As BrowserContext = New BrowserContext(params2)
Dim browser2 As Browser = BrowserFactory.Create(context2)