How do I setup a cookie to expire after a certain time?
John Zukowski You can set the maximum age of a cookie with the setMaxAge(int seconds) method:
- A positive value is the maximum number of seconds the cookie will live, before it expires
- A negative value means the cookie will not be stored beyond this browser session (deleted on browser close)
- Zero means to delete the cookie