Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 8950
  • Last Modified:

Element CFID is undefined in SESSION

I 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=#CreateTimespan(0,0,15,0)#
   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?
0
liltyga
Asked:
liltyga
  • 11
  • 5
3 Solutions
 
pinaldaveCommented:
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
0
 
pinaldaveCommented:
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
0
 
pinaldaveCommented:
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_Name" to ensure that CFMX does not try to access the registry.

Here is an example of a good CFApplication tag.

<cfapplication name="Your_App_Name"
clientmanagement="yes"
sessionmanagement="yes"
setclientcookies="yes"
setdomaincookies="yes"
sessiontimeout="#createTimeSpan(0,8,0,0)#"
applicationtimeout="#createTimeSpan(0,8,0,0)#"
Clientstorage="Cookie"
loginstorage="session">

Regards,
---Pinal
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
liltygaAuthor Commented:
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.  
0
 
pinaldaveCommented:
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
0
 
liltygaAuthor Commented:
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.
0
 
pinaldaveCommented:
hi lityga,
I am sorry to here that... may be this is due to some other reasons...
may be this is not apropriate but can we see that error or having test account for 10 min or something?
Regards,
---Pinal
0
 
liltygaAuthor Commented:
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?
0
 
pinaldaveCommented:
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
0
 
pinaldaveCommented:
Hi liltyga,
I will go home after 45 min. So I was thinking to solve this issue before that if possible.

Regards,
---Pinal
0
 
liltygaAuthor Commented:
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>

 
0
 
pinaldaveCommented:
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_com"
                             sessionmanagement="Yes"    
                             applicationtimeout="#createtimespan(1,0,0,0)#"
                             sessiontimeout="#createtimespan(0,1,0,0)#">


<cfset session.cfid = cfid>
        <cfset session.cftoken = cftoken>
        <cfset session.urltoken = "cfid=#session.cfid#&cftoken=#session.cftoken#">

Regards,
---Pinal
0
 
pinaldaveCommented:
Hi liltyga,
this is how i set up cookies....if required.

<cfset cookie.username = get_acct.username>
                <cfset cookie.account_id = get_acct.account_id>
                <cfset session.get_acct = get_acct>

Regards,
---Pinal
0
 
pinaldaveCommented:
let me know if any of this is usuful to you.
Regards,
---Pinal
0
 
anandkpCommented:
0
 
liltygaAuthor Commented:
Thanks for all your help!
0
 
pinaldaveCommented:
glad to help you and Anadkp that link is good one.
Regards,
---Pinal
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 11
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now