In my web application, I use an exit button which runs session.abandon to close the session and then close t开发者_开发技巧he browser.
It does not work with multi-tabs in IE. If I open my application in two tabs, I click on the exit button in one tab which abandons the session and close the tab. But the application in another tab can still work.
Is there any way to close the session for this application in all the tabs?
Thanks
I believe you've a misunderstood of server session.
Closing server's session means clearing session's id and associated data to requester client.
A session starts when a client access to your web, and ASP.NET assigns a session identifier to it, ensuring subsequent requests would have an isolated set of data for this identifier.
When you abandon the session, that identifier expires.
Finally, when you open a new tab, ASP.NET starts a new session.
An ASP.NET isn't like a Windows application. "The application" is always started (excepting when application pool is recycled, IIS is restarted or the application hasn't been accessed already).
So, right, you abandon an user session, but the other tab should be in another session (if you've authentication, it should authenticate in order to work with your application, and so on).
精彩评论