Recommendations for multi-user, multi-session, multi-language, cookie environments

Our current application works fine, but when you try to make a mistake, we found out that when you log in with the same user on several tabs with another organization (there is a drop-down menu on the organizationโ€™s home page that sets a cookie whenever it changes. )

on tab one it is org 1 and tab 2 is org2, the cookie has org 2 later , but when we return to tab1 (which has org1) and save the record, org 2 will be saved with the record

So can someone share with us some kind of checklist that addresses these types of problems.

+4
source share
3 answers

Unfortunately, there is little you can do about this. Browsers share cookies between tabs. And form authentication uses cookies to track users. You will get the same behavior with other sites, for example gmail, for example.

+2
source

You can add a hidden data field to recognize each view. you store all the data on the server side, such as session, cache, database and show a "unique" view

0
source

I hope you find an elegant solution to this problem, but AFAK one browser instance just shares the same identity.

To deal with this situation, we use HIDDEN on the main page, which is part of the main form. Its value is randomly generated when loading the first page. Later, the value is saved between requests. Session values โ€‹โ€‹are stored using a HashTable key of a hidden value.

2 more hacks necessary for its work.

  • Response.Redirect runs with a simple form that uses the POST method to pass the HIDDEN value to a new page.
  • All hrefs left-clicked, also placing the HIDDEN value (if the user uses the "Open in New TAB / Window" direct redirect without message, just creates a new HIDDEN value - a new slash.)
0
source

Source: https://habr.com/ru/post/1335956/


All Articles