Discussion:
set cookies to expire
(too old to reply)
Gonzosez
2006-01-10 19:44:07 UTC
Permalink
How can I set my cookies to expire when the the user leaves the site?
Kyle Peterson
2006-01-10 19:46:03 UTC
Permalink
if you want that one way is to use session variables not cookies..
Post by Gonzosez
How can I set my cookies to expire when the the user leaves the site?
p***@bullschmidt.com
2006-01-10 22:01:11 UTC
Permalink
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

Loading...