C# .NET - session values collide between users

Asked By muthuraman alexander on 02-Feb-12 05:48 AM
hi all,
i had developed a web site which has the provision of user login.
the site is basically for  shopping

when a user select some items to purchase ..the selected items will be inserted into a session in the form of a datatable
it was working perfectly but  sometimes
the items selected by one user got collided with another user in the when he logged in at the same time ...
that is the item selected by user-A also seen at the selection list of the user-B.

how can i solve this problem
please advice me

thanks
muthu
dipa ahuja replied to muthuraman alexander on 02-Feb-12 06:09 AM
You are going wrong with your project

Never save such values like selected items to the session.

Session is used to store the simple value and as you know when session time over all the values will be gone. Better way is to store the selected value of users (Added to Cart) in one temp table

and in this temp store the values based on the "username" which is the unique column. so there is no issue of conflict items of users. you can track users items based on the username

Hope you get it!
Web Star replied to muthuraman alexander on 02-Feb-12 06:41 AM
No this never happen one user's session value show to other user because session stored value with user specific when open Explorer and login than session will be initialize with that window or that users only that never share with other system.

But same time i agree with you if you are open two browser on same computer with two different user login than that will be happen but this is not problem of session this is problem with IE 8.0 which sharing on same system.

Basically in practical senario this is not possible to two different persion login on same computer.

hope you got my point
Anantha replied to muthuraman alexander on 03-Feb-12 02:14 AM
...items will be inserted into a session in the form of a datatable

Could you clarify further what you mean.

If you are storing into a table, then contention will happen. So you should follow the first post.

If not, then you have to look elsewhere.

OK