Reputation:
I have an ASP.NET 2.0 application that is using the Forms Authentication. When a user logs into the application a session object is created as well as a cookie and everything is fine. The application allows a user to pick between multiple databases to work from depending on their privileges. The problem is if the user wants to open another tab in IE to log in and work in a different database along side the first tab they logged into it doesn't work. It just sees the previous tab's session and loads the new tab directly into the previous tab's database, bypassing the login screen.
Is there a way to uniquely separate sessions so that I could have users log into the application in the same browser (different tabs) and have multiple sessions connected to the correct tab?
Thanks Chris
Upvotes: 1
Views: 1511
Reputation: 2281
Session indeed is not a good choice here because when you tried to open the new instance of the application at that time you are actually killing your previous session. The other ways of implementing is to use view state.
Upvotes: 1
Reputation: 566
I think sessions are not the right place to store your data. You might consider using another state maintenance solution such as ViewState,Form variables, Querystring, cookies etc.
You can find more information from Here
Upvotes: 3
Reputation: 56550
Tabs in browsers do not offer isolation like this, even opening new instances of the browser often doesn't support this - it's browser dependant. You could consider appending the database name as a parameter in the URL, this would be different for each tab
Upvotes: 1
Reputation: 19661
Don't use sessions. Pass everything around in hidden fields.
Each time the user makes a selection that you don't want to be replicated to another window, store that value in a hidden field so that it will be passed along with the next postback. Obviously this data will be lost if any other page navigation is performed, so this limits you.
Upvotes: 1