In the above example if the cookies are disabled then the program will always written new session. But I've tried this program after disabling the cookies but it writtens welcome back when I refresh the window.How is it possible?
As far as i know the server first tries to use Cookie by default as a session tracking mechanism, if the cookies are disabled then it uses URL Rewriting by default. Hence in your case the session is still active.
Your code works fine in my case, i.e. it only shows "new session" when refreshing the page and cookies are disabled (I'm using Firefox). Are you sure cookies are disabled in your browser? (just checking) [ March 23, 2007: Message edited by: Johan Pelgrim ]
Johan Pelgrim, The Netherlands
SCJP 1.4, SCWCD 1.4, [Studying for SCBCD 5 & Spring Framework Certifications]
Originally posted by Shrenik Sakriya: As far as i know the server first tries to use Cookie by default as a session tracking mechanism, if the cookies are disabled then it uses URL Rewriting by default. Hence in your case the session is still active.
Shrenik Sakriya
No. the server will use both at the first response if you did use URL rewriting in your code. if cookie is enabled, then subsequent responses will ignore URL rewriting in your code. otherwise, they will use URL rewriting.
Think about it. If hte server only uses cookie as default on the first response, what if the cookie is disabled by the user? then the next request comes in without any session id information, then the server will have to create a new session. This is certainly not what we want.
Originally posted by Sunder Ganapathy: First time you get new session and when you refresh you get welcome back.
Actually the program runs fine and the output is what you are getting with cookies enabled.But the problem is running the program after disabling cookies(Read the first Question of the forum).When you disable cookies you should get only new session every time you refersh the browser.But instead welcome back is printing.
Apparently the difficulty you are having in IE is due to the way IE treats the localhost domain. I was able to repeat your problem and after some research uncovered this article: