tags:

views:

93

answers:

3

If I set cookie to expire in 1 month.

But during that month,I visit the site every day.

Will the cookie still expire after 1 month?

A: 

The expiration date will be renewed everytime you visit the site.

The MYYN
Can you show me the reference that acknowledge this?
Mask
That's actually wrong. Cookie expiration dates are concrete, not a sliding window, unless you write code to rewrite it on every access.
blowdart
If you just think a bit about it, you realise that it simply doesn't work that way. The browser wouldn't know what the expiration date should be updated to.
Guffa
+1  A: 

The expiration date is stored in the cookie as a simple date, like 25th Dec 2009. You will have to recreate that cookie (in other words to renew it), if you do not want it to expire after the first month.

treaschf
+1  A: 

It depends on how you set your cookie - if you set it according to the algorithm:

expiration date = today date + 30 days

then yes, every visit (assuming you recreate the cookie every time) will of course result in cookie expiration date being extended. If you have some conditions on which the cookie is not recreated (e.g. only checking if it exists), it might be the other way. For more detailed advice you should post a sample of your code.

bth