Forums Register Login

Doubt between setMaxAge() and setMaxInactiveInterval() method

+Pie Number of slices to send: Send
I have doubt on these two methods :- setMaxAge() for cookie and setMaxInactiveInterval() for session... what will happen if we set -1 for these method?

can someone please clarify.
+Pie Number of slices to send: Send
A negative number for setMaxIncativeInterval causes the Session to never expire.
A negative number for setMaxAge causes the cookie to persist until browser shutdown.
+Pie Number of slices to send: Send
when you will put -1 as a value that means for cookies you don't want that cookie to be removed even when session expires or when client leaves the browser. In case of session you don't want to invalidate it on the basis of time.

Correct me if i am wrong
+Pie Number of slices to send: Send
 

Ankit Mishra wrote:when you will put -1 as a value that means for cookies you don't want that cookie to be removed even when session expires or when client leaves the browser. In case of session you don't want to invalidate it on the basis of time.

Correct me if i am wrong



Not correct.
This is what the API states for setMaxAge()...

A negative value means that the cookie is not stored persistently and will be deleted when the Web browser exits. A zero value causes the cookie to be deleted.

 
+Pie Number of slices to send: Send
got your point Sebastian thanks went through the api too ..
+Pie Number of slices to send: Send
 

Ankit Mishra wrote:got your point Sebastian thanks went through the api too ..




Thanks Sebastian and Ankit for your quick response.
Shiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1546 times.
Similar Threads
session doubt
setMaxInactiveInterval and <session-timeout> question
Doubt in Session Time out.
session that never dies
Doubt in Cookies
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 04:45:46.