posted 19 years ago
Hi,
You are right javaranch is using cookie that is stored in cookies folder within windows directory.First check the contents of cookie file stored by javaranch. You will find your login name,password and jsessionid along with other information.
If cookies are enabled by your browser and you did not log out last time whenever you browsed the website, you will always find yourself logged in automatically because of your info that is stored in cookie file. Sessions don't play any role here so it does not matter session is alive or not. Don't relate this case with the life of session or your main problem of closing a browser.
Let's come to the point!
Cookies never expire, it's only jsessionid that is declared invalid by the webserver. Decisions regarding to session expiration is a policy of jvaranch that we can't discuss. Whenever you place a request to the web server jsessionid is added as a part of request header by your browser.
Now think, how can a webserver know that no other request will be sent by the client? To solve this problem sessions are managed by the server.
If you send a request then close the browser and again send a request, webserver could never know that you closed the browser once between two requsts if session is not timed out(depends upon policies).
I think it's clear now that by closing browser you can never indicate to server that you willn't send any request now or you have completed your work. If it's so, how can a session get expired by the server on the closing event?
Please read my previous post again.
Hope, it will help you.
Regards,<br />Prateesh<br />SCJP 1.4,SCWCD 1.4