.NET Geeks
-Unleash Your Inner Geek!!!

Tab Behavior with Session

I may have missed the memo on this one, but the session object (and thus the context) crosses tabs in both Firefox and IE.  What I mean is that opening the same website in a new tab will still keep all of your context information.  In order to generate a new context, you must open a new browser instance entirely!  I did not expect this behavior at all.  I thought that a new tab was similar to opening a new browser window.  Apparently, it is not.

If you want to try this yourself, create a new ASP.NET site, drop a label with an id of "DisplaySession" on the page, and in the default page codebehind on the page load event, write the following:

        if (null == Session["TestValue"])
            Session["TestValue"] = DateTime.Now.ToLongTimeString();

        DisplaySession.Text = Session["TestValue"].ToString();

Now, run the site (with or without debugging).  Note the time.  Wait a few seconds, open a new tab, and open the same page.  Viola!  Same time.   


Posted Oct 30 2006, 11:41 AM by jsmith
Filed under: , ,
Powered by Community Server (Non-Commercial Edition), by Telligent Systems