Aegis,
Thanks for your explanation.
As per your comments once a session got expired new CFID/CFTOKEN values are generated. I created a sample application to check this where I set session time out as two mnts and that ssession got expired. But when I check the cookies in browser I am getting same values for CFID/CFTOKEN. But when I delete this I am getting new values. So just to know that whenever a session got expired , cant we see new updated CFID/CFTOKEN values in browser.??
I followed below steps.
1.Made a request for - http://localhost:8500/poc/nbt/
2.got new CFID/CFTOKEN values as 10901/13092563
3.After session timeout (2 mnts) I checked my browser cookies but I can see same values for CFID/CFTOKEN.
I had written files in onSessionEnd method also ( as given below ) to check whether I am getting new CFID/CFTOKEN values, but no luck its the same old values only.
<cffunction name="onSessionEnd" returnType="void">
<cfargument name="SessionScope" required=True/>
<cfargument name="ApplicationScope" required=False/>
<cffile action="write" file="C:/ColdFusion9/wwwroot/time_END.txt" output="#NOW()#">
<cffile action="write" file="C:/ColdFusion9/wwwroot/cfid_END.txt" output="#ARGUMENTS.SessionScope.CFID#"
</cffunction>
Any I dea why this is happening so??
Let's say you set your session timeout to 2 minutes.
When you visit the page, you start a new session, CF generates a CFID/CFToken and SENDS that back to you in your first request's response.
When you visit a page before the session time's out, your browser sends the CFID/CFToken with the request, CF sees this, verifies its a live session, and doesn't issue you a new one.
If you wait the 2 minutes for a session to timeout, CF kills the session, but DOES NOT MESS with your Cookies. It doesn't matter, because they're invalid anyways.
When you make a request, you send the now old CFID/CFToken, CF sees that this does not correlate to a live Session, and generates a new CFID/CFToken which it sends back to you now and updates you cookies with the new values.
Just because a session times out on the server does NOT mean ColdFusion removes the cookies from the user's browser. It just states that "For that CFID/CFToken combination, the session no longer exists, so let me generate a NEW session for you and send you it's CFID/CFToken to correlate your visitor to the new SESSION scope.
Waiting for the timeout and checking your cookies should show the last cookies you had when you made a request. Nothing new.
In your onSessionEnd() method, it will BE the old values because when the session expires, that method gets a COPY of the SESSION and APPLICATION scope, (the SESSION that just expired) and that is the old CFID/CFToken data. CF is performing as one would expect. What is it you're trying to do? I think the problem here is you're not understanding how sessions work.
A SESSION, to CF is when it takes a provided CFIF/CFToken cookie from a user's request and checks to see if it is valid. If so, then any variables stored into the SESSION scope are made available to that request's processing. These cookies act as a way of your browser saying who they are. By default, Session values are stored in RAM.
When you don't make a request in the amount of time specified in the THIS.sessionTimeout value, CF does not mess with ANY cookies on your machine. It simply says. "Hey, those variables I was holding for the SESSION that was for THIS CFID and THIS CFToken, well, delete them. The session expired. The browser won't see anything different whatsoever until it makes another request.
When you make a request, again, your browser provides CF the CFID and CFToken cookies, but this time CF says "Hey, that session expired, so I'll make a new one for you (fires off the onSessionStart() method) and it sends back a new CFID and CFToken cookie to the user which now correlates to the new session. A session that will stay alive as long as the user makes requests within the timeout specified.
If you deleted your cookies, the SESSION would still be ALIVE, however it would just be inaccessible, and after the timeout value, CF would expire it. But if you deleted your cookies, upon making a request to the server, there would be NO CFID/CFToken cookies sent, so CF would create a new session for you and send you back a new CFID/CFToken.