set cookies to expire

Discussion in 'ASP General' started by Gonzosez, Jan 10, 2006.

  1. Gonzosez

    Gonzosez Guest

    How can I set my cookies to expire when the the user leaves the site?
     
    Gonzosez, Jan 10, 2006
    #1
    1. Advertising

  2. if you want that one way is to use session variables not cookies..


    "Gonzosez" <> wrote in message
    news:...
    > How can I set my cookies to expire when the the user leaves the site?
    >
    >
     
    Kyle Peterson, Jan 10, 2006
    #2
    1. Advertising

  3. Gonzosez

    Guest

    I agree that if you don't want a cookie to last longer than a session,
    then use session variables. But anyways here is an answer to your
    question about having a cookie quickly expire.

    Cookie Monster: Using Cookies in ASP
    By Ian Stallings
    http://www.4guysfromrolla.com/webtech/051099-1.shtml
    <<
    The next important property is the Expires property. This specifies the
    date the cookie should expire. If it is set to a past date then it will
    expire when the browser is closed.

    When setting the date it can be set a couple of ways. You can use the
    current date and add or subtract days like so:

    Response.Cookies("name").Expires = Date + 365
    >>


    Best regards,
    J. Paul Schmidt, Freelance Web and Database Developer
    http://www.Bullschmidt.com
    Access Database Sample, Web Database Sample, ASP Design Tips
     
    , Jan 10, 2006
    #3
    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. Joey Powell

    Forms Authentication Cookies Never Expire

    Joey Powell, Dec 4, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    6,957
    Mike Moore [MSFT]
    Dec 4, 2003
  2. Mel
    Replies:
    3
    Views:
    480
    Toby Inkster
    Mar 16, 2005
  3. th3dude
    Replies:
    4
    Views:
    659
    th3dude
    Jul 24, 2008
  4. _Who
    Replies:
    7
    Views:
    2,732
  5. Tongass Park Neighborhood Association, Juneau Alas

    Cookies expire immediately, not when set to expire

    Tongass Park Neighborhood Association, Juneau Alas, Oct 1, 2009, in forum: ASP General
    Replies:
    2
    Views:
    1,232
    SQLDude
    Nov 24, 2009
Loading...

Share This Page