Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
What is the best to manage multi-user profiles ??
I found that to create a new RequestContextSettings and to save into a specific folder was a possible way :
CefSharp Wpf , Session Cookie for multiple instances
Yet, that implies to do it before the CEFSettings initialization.
So, perhaps I have to shutdown the CEF, before changing user profile.
But how to manage that in a clean manner many times for a session of the appli ?
I read too the Cef.Shutdown Method is launched only one time
https://cefsharp.github.io/api/51.0.0/html/M_CefSharp_Cef_Shutdown.htm
So, my question : in a current session, what is the way for a
RequestContextSettings lRCS = new RequestContextSettings();
requestContextSettings.CachePath = "another user";
myBrowser.RequestContext = new RequestContext(lRCS);
without getting an error message, saying that ' RequestContext must be set before the underlying CEF browser is created.'
Tx a lot for your help.
@amaitland
Your help is really appreciated. This code is extract from Request Context (Browser Isolation)
var requestContextSettings = new RequestContextSettings { CachePath = cachePath2};
browser= new ChromiumWebBrowser("mysite.com");
browser.RequestContext = new RequestContext(requestContextSettings, new CustomRequestContextHandler());
and that raises 2 errors :
Code Erreur CS1503 Argument 1 : impossible to convert 'CefSharp.RequestContextSettings' to 'CefSharp.IRequestContext'
Code Erreur CS0246 type 'CustomRequestContextHandler' can't be found. (Missing using directive or assembly référence ?) .
But if I modify the last line, with only one parameter call
browser.RequestContext = new RequestContext(requestContextSettings);
I can run something, and I get cache datas in the cachePath2. Yet, the screen stays in white if I do
browser.CloseDevTools();
browser.Dispose();
var requestContextSettings = new RequestContextSettings { CachePath = cachePath2};
browser= new ChromiumWebBrowser("mysite.com");
browser.RequestContext = new RequestContext(requestContextSettings);
or the browser stays with the previous page I had with the user1, if I don't add the CloseDEvTools + Dispose.
So I guess that the CustomRequestContextHandler
is an important parameter to update the browser, and to not freeze it.
But I don't find how I can have complete assembly references.
I use VS2017, Winforms and Nuget package 71.0.2.
cef.redist.x86" version="3.3578.1870" targetFramework="net461"
Tx again for your help.
–
–
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.