Tech Off Thread

5 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

ASP.net, multiple tabs

Back to Forum: Tech Off
  • User profile image
    alexmac

    Hi,
    We have an ASP.net application that stores items in session.

    We found the following:
    If another tab is opened in IE and directed to the app then this tab also shares the same session as the 1st tab
    If another window is opened by ctrl n this also shares the same session as the original window
    If an new instance of IE is opened this does NOT share the same session

    We would like a way of identifying individual instances however the window is open. 

    As the session seems to be shared if opened as a tab or ctrl N how would you suggest this is done? I would imagine that since session is shared so will cookies be?

    Thanks,

    Alex

  • User profile image
    Maddus Mattus

    Cookies are bound to a domain (channel9.msdn.com), so they are shared across sessions.

    Also if you right-click open link in new browser, the session gets shared. Highly annoying Smiley

    I don't know a way to detect if you use multiple browsers for one session. But I am interested in your findings Smiley

    Edit After some researching:

    -  Request.Cookies[0] {System.Web.HttpCookie} System.Web.HttpCookie
      Domain null string
    +  Expires {1/1/0001 12:00:00 AM} System.DateTime
      HasKeys false bool
      HttpOnly false bool
      Name "ASP.NET_SessionId" string
      Path "/" string
      Secure false bool
      Value "mplb0m55gnlrtt45rg4xdl55" string
    +  Values {mplb0m55gnlrtt45rg4xdl55} System.Collections.Specialized.NameValueCollection {System.Web.HttpValueCollection}
    +  Non-Public members  

    Each request holds a cookie with a session id. That cookie get copied if you open in new tab, or open in new window. That's how your session get's shared.

    If you make a new window, the initial request does not hold this cookie. And it's not persistant (check the expiration date), so you open a new session.

  • User profile image
    alexmac

    Maddus Mattus said:

    Cookies are bound to a domain (channel9.msdn.com), so they are shared across sessions.

    Also if you right-click open link in new browser, the session gets shared. Highly annoying Smiley

    I don't know a way to detect if you use multiple browsers for one session. But I am interested in your findings Smiley

    Edit After some researching:

    -  Request.Cookies[0] {System.Web.HttpCookie} System.Web.HttpCookie
      Domain null string
    +  Expires {1/1/0001 12:00:00 AM} System.DateTime
      HasKeys false bool
      HttpOnly false bool
      Name "ASP.NET_SessionId" string
      Path "/" string
      Secure false bool
      Value "mplb0m55gnlrtt45rg4xdl55" string
    +  Values {mplb0m55gnlrtt45rg4xdl55} System.Collections.Specialized.NameValueCollection {System.Web.HttpValueCollection}
    +  Non-Public members  

    Each request holds a cookie with a session id. That cookie get copied if you open in new tab, or open in new window. That's how your session get's shared.

    If you make a new window, the initial request does not hold this cookie. And it's not persistant (check the expiration date), so you open a new session.

    Hmm I will have to have a look into this some more!

  • User profile image
    dvr123

    alexmac said:
    Maddus Mattus said:
    *snip*
    Hmm I will have to have a look into this some more!

    did anyone find a solution? I think I am going to have to append a guid to viewstate and now store my object using a key/value collection in session with the guid, I am just not happy about this solution, for any site that deals with newsletters and lots of users returning in a short space of time is looking at tinkering on the edge of memory death (freaken 2003 x86!) . How do we send a request to the asp.net team for a out the box solution in 2010!!!!!

  • User profile image
    Harlequin

    dvr123 said:
    alexmac said:
    *snip*

    did anyone find a solution? I think I am going to have to append a guid to viewstate and now store my object using a key/value collection in session with the guid, I am just not happy about this solution, for any site that deals with newsletters and lots of users returning in a short space of time is looking at tinkering on the edge of memory death (freaken 2003 x86!) . How do we send a request to the asp.net team for a out the box solution in 2010!!!!!

    You need multiple tab stuff too? Doesn't sound like you are in your post, you just need cookies to remember things.

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.