Click here to Skip to main content
15,915,509 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In my c# asp.net application, when the user is logging in i am storing all the user details in session.

But i am running in to a situvation where useres information is getting swapped(First user is getting the details of second user).

In my scenario multiple users can log in from the same system.

My observation is even though if a new IE(not tab) is opened the same session id will be shared.

Any ideas?
Posted

The major browsers (like IE, FF and Google Chrome) all default to using the same collection of cookies regardless of whether you are opening a duplicate web page in a new tab or a new browser instance.

The result is that 2 different tabs, or 2 instances of the same browser, by default, will look like the same session to the server.

Because the multiple instances use the same cookies, the server cannot tell requests from them apart, and will associate them with the same Session data, because they all have the same SessionID, assuming cookie-based SessionID.

Generally there is nothing wrong with this behaviour, and you would have to have a good business case against that behaviour to want to code a work around.

on the other hand, what you are after is to treat a group of user/server interactions as a kind of "session within a session", you may be able to do this by storing a random GUID in ViewState, and checking it on postback.
 
Share this answer
 
Hi,

if you are using IE with different instance , session information will be shared. if you are using IE, FireFox, Chrome then all different browser will keep different session information.

you can also do one thing, store session information in database and separate each instance with unique id (say GUID). this may help you,

thanks
-Amit.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900