Hi liltyga,
my team mate asking if you are using same browser for login and logout? This may sound not stupid but just making sure.
Regards,
---Pinal
Main Topics
Browse All TopicsI have an application that has been working for the past 5 months now with no problem. All of the sudden, after I log out and attempt to log back in, I get the following error:
Element CFID is undefined in SESSION.
This is the pertinent code in the application.cfm file:
<!---application tag--->
<cfapplication name="RMCI"
SessionManagement="yes"
SETCLIENTCOOKIES="NO">
<cfset CookieDomain=".domain.com"
<!---name application, and enable Session and Application variables--->
<CFAPPLICATION NAME="Security_Test"
SESSIONMANAGEMENT="YES"
SESSIONTIMEOUT=#CreateTime
SETCLIENTCOOKIES="NO">
<CFLOCK SCOPE="SESSION" TYPE="READONLY" TIMEOUT="5">
<CFCOOKIE NAME="CFID" VALUE="#SESSION.CFID#">
<CFCOOKIE NAME="CFTOKEN" VALUE="#SESSION.CFTOKEN#">
</CFLOCK>
use cf_sessionWatch to warn users when they are about to timeout --->
<cf_sessionWatch launchTime="15">
This is the information from the logout.cfm file - When I commented this out; the error went away, but the session never dies:
<cfset user=session.Username>
<!--- <cfloop collection=#session# item="i">
<cfset StructDelete(session,i)>
</cfloop>
Any ideas as to how to resolve this issue?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Hi liltyga,
sorry for spamming, I should have my all the thoughts together in one post...I am not sure if following post is any applicable but I found saved on my archive. If this confuses you just ignore it ... may be it is the reason.
The CFRegistry tag was recently disabled. On CFMX this affects the CFApplication tag *if* client storage is left to it's default or set to "Registry".
At default, the CFApplicaiton tag has a parameter of clientstorage with a default value of Registry. By disabling the CFRegisty tag, this creates a conflit. To resolve the problem, the CFApplicaiton tag MUST include the clientstorage="Cookie" or clientstorage="Datasource_
Here is an example of a good CFApplication tag.
<cfapplication name="Your_App_Name"
clientmanagement="yes"
sessionmanagement="yes"
setclientcookies="yes"
setdomaincookies="yes"
sessiontimeout="#createTim
applicationtimeout="#creat
Clientstorage="Cookie"
loginstorage="session">
Regards,
---Pinal
Not a problem Pinal, I appreciate your response. Yest the same browser is being used for login and logout. It didn't start happening until yesterday. The error doesn't show up unti you login, logout, and try to login again or refresh the page. If I close the browser and open it again, it is fine until I try to login, logout, and login again. I had found the same "good CFApplication tag" code through Google, and made some mods to the application.cfm file before I posted this query, but the changees were to no avail.
Hi liltyga,
hum... this sounds like that your application does not have much of the problem except with sessions. When you login it works and when you logout it may be creating some problem ... and when you try to login again it is conflicting with old session ( should not be) but when you start new browser it is opening new session for sure and there is no previous data so it works fine...
okey this could be happening when you delete the session it may not be deleting them right or may be it is deleting only partially ( cfid ) or something... I was wondring if this is not working correct...
<!--- <cfloop collection=#session# item="i">
<cfset StructDelete(session,i)>
</cfloop>
how about if we try to use structclear(session)
let me knwo what is the output in that case...
Regards,
---Pinal
I tried it, but unfortunately that didn't work either - I got the same CFID is undefined in Session error when I refreshed the page after logging out, or trying to access the page directly again. It's so strange - I didn't do anything to this app for so many months, and all the sudden it is doing this.
It's actually internal, so I can't send a link, but I can provide more code if needed - all I know is that when I comment out the <cfloop collection=#session# item="i">
<cfset StructDelete(session,i)>
</cfloop>
the error goes away, but the session is not terminated. Is there a better way to terminate the session?
structclear(session) is also creating problem for you... so ... hum...
okey... if you use
structclear(session)
instead of this...
<cfloop collection=#session# item="i">
<cfset StructDelete(session,i)>
</cfloop>
and it is not working ... am I understanding that correct.
If this works once and does not work second time... is just confusing me...
i use structclear to delete them... complitely.....
Regards,
---Pinal
Thanks, I tried that and still get this error when logging in:
Element CFID is undefined in SESSION.
The error occurred in (directory path): line 24
22 :
23 : <CFLOCK SCOPE="SESSION" TYPE="READONLY" TIMEOUT="5">
24 : <CFCOOKIE NAME="CFID" VALUE="#SESSION.CFID#">
25 : <CFCOOKIE NAME="CFTOKEN" VALUE="#SESSION.CFTOKEN#">
26 : </CFLOCK>
Hi liltyga,
I just do not know... about this... i never programmed like this... this is what I usually do in my application.cfm for session...may be you can modify yours...
i never use cookies and session together...I think, session itself is fine... we do not need to set them in cookies... may be you do not need to that...
following is the code from my office session management code of application.cfm
<cfapplication name="dealers_ebizautos_co
sessionmanagement="Yes"
applicationtimeout="#creat
sessiontimeout="#createtim
<cfset session.cfid = cfid>
<cfset session.cftoken = cftoken>
<cfset session.urltoken = "cfid=#session.cfid#&cftok
Regards,
---Pinal
this link shld have the answer for u ...
http://www.macromedia.com/
Business Accounts
Answer for Membership
by: pinaldavePosted on 2004-08-27 at 09:05:16ID: 11914696
Hi liltyga,
okey. I think you might have tried this but, once someone login they usually get CFID and CFTOKEN
so, due to any reason they got deleted by another page or session while some one is logged in ...when they try to logout this is what happens.
So, close everything and try to login from the beginning and also make sure that no body else is using system and only you (one user) is using this system.
AFter that, if this happens it means that due to some code or some reason the session is getting deleted.
we had same problem once... due to some reason on our dev server all the sessions were deleted by the code of our API division and we Research division was really researching this problem for long time...
Regards,
---Pinal