This is old, but I just came across it and it needs a more complete answer. You can have as many browser instances open as you want, each with its own separate cache & cookies that are independent of the others. All you have to do is set the CachePath
settings property for each browser, making sure its path is distinct, and then create the browser.
An example scenario in which you might use this is with tabs, where Tab1 has Browser1, Tab2 has Browser2, etc. and each browser instance has no knowledge of the others. That is achieved by giving each browser its own cache path before creating it.
In VB .NET:
CEFPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\My\Special\Cache\Path"
If Not Directory.Exists(CEFPath) Then
Try
Directory.CreateDirectory(CEFPath)
Catch ex As Exception
MsgBox("Error creating cache directory" + vbCrLf + CEFPath,, "Error")
End Try
End If
Dim settings As New CefSettings()
settings.CachePath = CEFPath
'Settings.Proxy = new ProxyOptions(ip: "myipaddress", port: "myport", username: "myusername", password: "mypassword")
' initialization before creating instance
If CefSharp.Cef.IsInitialized = False Then
CefSharp.Cef.Initialize(settings)
End If
browser = New ChromiumWebBrowser("")
Dim requestContextSettings As New RequestContextSettings()
requestContextSettings.CachePath = CEFPath
'Optional:
requestContextSettings.PersistSessionCookies = True
'https://github.com/cefsharp/CefSharp/wiki/General-Usage
browser.RequestContext = New RequestContext(requestContextSettings)
I am using NuGet packages v83.4.20