Novice
Novice

Reputation: 535

How to share session and cookies between multiple instances of dotNetBrowser controls

How can we share the session, cookies, and any other context between multiple instances of dotNetBrowser control.

I am trying to achieve the following with dotNetBrowser control.

Create two instances of a windform application. Each instance is going to load the same url (test.com/login). In the first instance user credentials are provided to login. In the second instance it is expected that the same user is logged in on the same url.

So in short, the same logged in user should appear in both the instances while we logged in only one instance. The test.com/login is not in my control and I can not change anything on the website.

For the time being I am trying to be able to run two instances on the same computer but ultimately would like to share the session and cookies between instances running in more than one computers.

Please share what would be the right direction to achieve this.

Upvotes: 1

Views: 1211

Answers (1)

Vladimir
Vladimir

Reputation: 2277

DotNetBrowser library is based on Chromium engine. Chromium stores all cookies, cache, and other data files in profile directory. In DotNetBrowser you can control where the profile directory should be created via the BrowserContext class. All Browser instances that use the same BrowserContext instance will automatically share cookies, cache, and other data.

If we are talking about sharing cookies and session data between two Browser instances running in different computers, then I suppose we need to configure these Browser instances to use BrowserContext that is configured to store data files in a directory shared between two computers. I haven't tried that, so I cannot guarantee that it works.

It's possible that Chromium engine itself doesn't handle the situation when profile directory is located on a remote computer and two processes are trying to use it at the same time.

Upvotes: 0

Related Questions