Session cookie? Browser instance cookie?

Discussion in 'ASP .Net' started by Ben, Jun 2, 2004.

  1. Ben

    Ben Guest

    Hi, I'm sending out a session cookie. That is a cookie that has no
    expiration date. When I surf through the site, no problems, but if I close
    the browser and open it back up, the cookie is still there if other browser
    windows were open. Even if those windows didn't go to the site with the
    cookie or spawn from the browser that is visiting the site. This is causing
    a problem. People want to be able to close the browser to logout.

    How can I achive this in asp.net? Basically if they close the browser that
    was at the site, I want that cookie gone. The cookie persisting across
    browsers that haven't touched the site seems odd...

    If I close all open browsers, the cookie is finally destroied.

    TIA,
    Ben
     
    Ben, Jun 2, 2004
    #1
    1. Advertising

  2. "Ben" <> wrote in message
    news:uGmvc.2729$...
    > Hi, I'm sending out a session cookie. That is a cookie that has no
    > expiration date. When I surf through the site, no problems, but if I

    close
    > the browser and open it back up, the cookie is still there if other

    browser
    > windows were open. Even if those windows didn't go to the site with the
    > cookie or spawn from the browser that is visiting the site. This is

    causing
    > a problem. People want to be able to close the browser to logout.
    >
    > How can I achive this in asp.net? Basically if they close the browser

    that
    > was at the site, I want that cookie gone. The cookie persisting across
    > browsers that haven't touched the site seems odd...


    Sorry, this isn't an ASP.NET issue, it's a browser issue. In the case of IE,
    if you launch one copy of IE, then use it to create several other windows
    (using Ctrl-N, for instance), then they are all running in the same process,
    and they share cookies. If you launch a separate process, it will not share
    the cookies of the first one. This may work differently with different
    browsers, but I'd expect many if not most to share cookies.

    You might consider using hidden form fields instead of cookies.
    --
    John Saunders
    johnwsaundersiii at hotmail
     
    John Saunders, Jun 2, 2004
    #2
    1. Advertising

  3. Ben

    Ben Guest

    "John Saunders" <> wrote in message
    news:...
    > "Ben" <> wrote in message
    > news:uGmvc.2729$...
    > > Hi, I'm sending out a session cookie. That is a cookie that has no
    > > expiration date. When I surf through the site, no problems, but if I

    > close
    > > the browser and open it back up, the cookie is still there if other

    > browser
    > > windows were open. Even if those windows didn't go to the site with the
    > > cookie or spawn from the browser that is visiting the site. This is

    > causing
    > > a problem. People want to be able to close the browser to logout.
    > >
    > > How can I achive this in asp.net? Basically if they close the browser

    > that
    > > was at the site, I want that cookie gone. The cookie persisting across
    > > browsers that haven't touched the site seems odd...

    >
    > Sorry, this isn't an ASP.NET issue, it's a browser issue. In the case of

    IE,
    > if you launch one copy of IE, then use it to create several other windows
    > (using Ctrl-N, for instance), then they are all running in the same

    process,
    > and they share cookies. If you launch a separate process, it will not

    share
    > the cookies of the first one. This may work differently with different
    > browsers, but I'd expect many if not most to share cookies.
    >
    > You might consider using hidden form fields instead of cookies.
    > --
    > John Saunders
    > johnwsaundersiii at hotmail
    >
    >

    I don't remember this being an issue in asp. Maybe it was. I'll have to
    test with sessions. I didn't think sessions worked like that. Maybe I can
    store a session id with the cookie.
     
    Ben, Jun 2, 2004
    #3
  4. Thanks for John's informative suggestions.

    Hi Ben,

    I think John's suggestions are quite correct and you may done some simple
    tests to confirm this.
    A simple way is enable the ASP.NET page's Trace and view the cookie
    collection.
    1.If we use Ctrl-N to start multi browsers when an exsiting IE is started,
    they'll share cookies and Also use the
    same session(since sessionId bedefault is stored in cookie)

    2. IF we lanuch a new IE browser instance, they won't share the cookies(not
    persistent or set expire) and will use a
    new sessionID if it visit the same application

    In addition, the most important is such behavior is diffferent for
    different browsers. Thanks.

    Regards,

    Steven Cheng
    Microsoft Online Support

    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)

    Get Preview at ASP.NET whidbey
    http://msdn.microsoft.com/asp.net/whidbey/default.aspx
     
    Steven Cheng[MSFT], Jun 3, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jeff Smythe
    Replies:
    3
    Views:
    1,328
    Jeff Smythe
    Jan 2, 2004
  2. Shapper

    Cookie and Session Cookie Questions.

    Shapper, Apr 27, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    612
  3. =?Utf-8?B?amVycnkueHVkZGQ=?=

    session cookie and presist cookie?

    =?Utf-8?B?amVycnkueHVkZGQ=?=, Mar 7, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    511
    =?Utf-8?B?RGFycmVuIEtvcHA=?=
    Mar 8, 2006
  4. Joseph

    authentication cookie vs session cookie

    Joseph, Aug 8, 2003, in forum: ASP .Net Security
    Replies:
    4
    Views:
    410
    Yan-Hong Huang[MSFT]
    Aug 12, 2003
  5. Matt

    session cookie vs. regular cookie

    Matt, Jan 24, 2004, in forum: ASP General
    Replies:
    1
    Views:
    847
    Blair Bonnett
    Jan 25, 2004
Loading...

Share This Page