Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Element CFID is undefined in SESSION

Posted on 2004-08-27
17
Medium Priority
?
8,909 Views
Last Modified: 2013-12-20
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
Comment
Question by:liltyga
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 11
  • 5
17 Comments
 
LVL 21

Expert Comment

by:pinaldave
ID: 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
0
 
LVL 21

Expert Comment

by:pinaldave
ID: 11914718
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
 
LVL 21

Expert Comment

by:pinaldave
ID: 11914742
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.

 

Author Comment

by:liltyga
ID: 11915808
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
 
LVL 21

Expert Comment

by:pinaldave
ID: 11917577
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
 

Author Comment

by:liltyga
ID: 11918386
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
 
LVL 21

Expert Comment

by:pinaldave
ID: 11918539
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
 

Author Comment

by:liltyga
ID: 11918574
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
 
LVL 21

Expert Comment

by:pinaldave
ID: 11918589
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
 
LVL 21

Expert Comment

by:pinaldave
ID: 11918596
Hi liltyga,
I will go home after 45 min. So I was thinking to solve this issue before that if possible.

Regards,
---Pinal
0
 

Author Comment

by:liltyga
ID: 11918602
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
 
LVL 21

Assisted Solution

by:pinaldave
pinaldave earned 1000 total points
ID: 11918620
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
 
LVL 21

Assisted Solution

by:pinaldave
pinaldave earned 1000 total points
ID: 11918625
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
 
LVL 21

Expert Comment

by:pinaldave
ID: 11918660
let me know if any of this is usuful to you.
Regards,
---Pinal
0
 
LVL 17

Accepted Solution

by:
anandkp earned 1000 total points
ID: 11928931
0
 

Author Comment

by:liltyga
ID: 11932831
Thanks for all your help!
0
 
LVL 21

Expert Comment

by:pinaldave
ID: 11932849
glad to help you and Anadkp that link is good one.
Regards,
---Pinal
0

Featured Post

Looking for a new Web Host?

Lunarpages' assortment of hosting products and solutions ensure a perfect fit for anyone looking to get their vision or products to market. Our award winning customer support and 30-day money back guarantee show the pride we take in being the industry's premier MSP.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
What You Need to Know when Searching for a Webhost Provider
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question