Cefsharp: how to make ChromiumWebBrowser have standalone cookies

Created on 18 Oct 2016  路  3Comments  路  Source: cefsharp/CefSharp

Hi,all
I used same ChromiumWebBrowser in my program, now all ChromiumWebBrowser shared the same cookies, Is there any way to make ChromiumWebBrowser have standalone cookies ?

Thanks.

Most helpful comment

@duoduoxi Please read the issue template next time.

Isolation is achieved using a RequestContext. If you specify a unique cache for each unique RequestContext you should have cookie isolation. You can share a RequestContext between multiple instances.

c# browser.RequestContext = new RequestContext(new RequestContextSettings { CachePath = "cache1" });

https://github.com/cefsharp/CefSharp/blob/5248174f894cba94c11bdf4aefe6b74383326d6c/CefSharp.Wpf.Example/Views/BrowserTabView.xaml.cs#L44

All 3 comments

So you have a question to ask, where can you look for answers?

Please take the time to read the issue template, if you have a question, ask it on Gitter first.
https://github.com/cefsharp/CefSharp/blob/master/ISSUE_TEMPLATE.md

@duoduoxi Please read the issue template next time.

Isolation is achieved using a RequestContext. If you specify a unique cache for each unique RequestContext you should have cookie isolation. You can share a RequestContext between multiple instances.

c# browser.RequestContext = new RequestContext(new RequestContextSettings { CachePath = "cache1" });

https://github.com/cefsharp/CefSharp/blob/5248174f894cba94c11bdf4aefe6b74383326d6c/CefSharp.Wpf.Example/Views/BrowserTabView.xaml.cs#L44

@amaitland
Sorry , I am not familiar with github. I will ask question on gitter next time.
Thank you very much.

Was this page helpful?
0 / 5 - 0 ratings