two anonymous user at a time

174 Views Asked by At

We are using anonymous identification in asp.net. Anonymous identification creates cookie whenever user lands on our application first time. according to the value of cookie we identify our user and made our business check whenever user lands on our application. It works fine with one cookie/user/anonymous user at a time.

Now i want two parallel anonymous user in one browser at a time. Can you please help me regarding this? How can i do that in Asp.NET MVC? How will I manage two cookies at a time?

let suppose two tabs are open in browser so it mean two user are present. How will system behave when user enters same URL in 3rd tab?

1

There are 1 best solutions below

2
On

Note: This is a bad idea, and users sharing a browser session seems really fishy to me. You could also use Chrome named users or an incognito session, or different browsers. However, I will present a solution assuming that the strange requirement stands.

You are looking for cookieless sessions. Add this to your web.config in the system.web section:

<sessionState cookieless="UseUri" regenerateExpiredSessionId="true" />

Note that you may find that this is not officially supported anymore in MVC, but does work in many cases. It worked in my simple test.

This will use the URL as the session identifier with each user getting a unique session upon hitting the site without a session in the URL. This is not secure at all because users like to share links and in this case they will be sharing a link to their session.

For your case, this may be sufficient.

More info here.