I'm developing a web application. I have a small problem with sessions when a user open the same window in the same session.
For example: Now, the user open the page user and he select a user I store this object in session (Session["user"] = user), if he open the same window in another tab browser and he select other user I override the session value (Session"["user"] = user).....
I'm thinking solutions:
- Avoid that the user can open the same window in the same PC
- Create unique id for each page opened by the user
What do you think? Wich is the better solution?
Thanks for your help and best regards,
In this instance you have to use cookieless sessions - in web.config in system.web
what this does is insert a session id into the url so you get something like, www.host.com/(abc15284dndhjkdm)/app.aspx. thisis then unique per tab and so the user can have uniqie session per tab.
Edit: - here is the code for the aspx pages i show at web3.adprs.net/test/test1.aspx i mention below
Test1.aspx
Test1.aspx.vb
Test2.aspx
web.config
HTH
Thanks all for your responses.
I read the post How to differ sessions in browser-tabs? and I found severals solutions to generate unique id per tab.
The solutions are:
I'm going to review them and I tell you the result.
If somebody knows another solution, allways is wellcome!
Best regards,
I don't think you can prevent a user from opening the same page in two different tabs or browsers. So, if you need do make sure each window is a distinct "session" in your application, you'll need some kind of unique ID, perhaps stored in a hidden HTML input.