keeping session alive after browser closed, possible?

Discussion in 'ASP .Net' started by soni2926@yahoo.com, Sep 18, 2008.

  1. Guest

    hi,
    i'm working on a site, which has a session created after a user
    logins, each page checks to make sure the session is there onload
    otherwise redirects to the login page. now the clients are asking us
    to make a remember me feature, is there any way to do this with the
    existing session set up? or do i need to rework it, as remember me
    from what i was planning was going to drop a cookie, so do i need
    change all those session checks to cookie checks or anyway to have
    remember me work with sessions instead? as they want it so if they
    close the pc for the night or just the browser and come back later or
    the next day login should not be required if they directly hit the
    homepage.

    Thanks.
     
    , Sep 18, 2008
    #1
    1. Advertising

  2. Hans Kesting Guest

    formulated on donderdag :
    > hi,
    > i'm working on a site, which has a session created after a user
    > logins, each page checks to make sure the session is there onload
    > otherwise redirects to the login page. now the clients are asking us
    > to make a remember me feature, is there any way to do this with the
    > existing session set up? or do i need to rework it, as remember me
    > from what i was planning was going to drop a cookie, so do i need
    > change all those session checks to cookie checks or anyway to have
    > remember me work with sessions instead? as they want it so if they
    > close the pc for the night or just the browser and come back later or
    > the next day login should not be required if they directly hit the
    > homepage.
    >
    > Thanks.


    The session itself doesn't close immediately when the browser is closed
    (the server doesn't know that that browser closed). But as the browser
    closes, it forgets it's session-cookie, so it can't go "back" to that
    session.

    What you will need to do is have a permanent cookie (that is: with
    expiry date) stored on the client. When a "guest user" (that is: not
    logged in) hits your homepage, check that cookie. If it contains a
    valid "token" (you can decide what that is), then log that identified
    user in automatically.

    If the user explicitly logs out, remove that cookie by overwriting it
    with an empty one.

    Hans Kesting
     
    Hans Kesting, Sep 19, 2008
    #2
    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. hoenes1
    Replies:
    0
    Views:
    389
    hoenes1
    Aug 16, 2004
  2. =?Utf-8?B?RGF2ZSBBbHZhcmFkbw==?=

    Keeping a session alive when accessing an ASP page with .Net code

    =?Utf-8?B?RGF2ZSBBbHZhcmFkbw==?=, Sep 1, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    666
    =?Utf-8?B?RGF2ZSBBbHZhcmFkbw==?=
    Sep 1, 2005
  3. Michael Fortin
    Replies:
    1
    Views:
    5,744
    John C. Bollinger
    Oct 12, 2004
  4. Replies:
    2
    Views:
    553
    =?Utf-8?B?V2lsbGlhbSBTdWxsaXZhbg==?=
    May 3, 2006
  5. hisan
    Replies:
    1
    Views:
    1,367
    Dan Stromberg
    Jun 25, 2012
Loading...

Share This Page