Skip to main content
Known Participant
June 11, 2009
Question

Element CFID is undefined in SESSION.

  • June 11, 2009
  • 3 replies
  • 15613 views

Hi i got error

Element CFID is undefined in SESSION.

i had a file test.cfm and in this i hada session logic as

<cflock scope="session" timeout="10">
    <cfset myURLToken = session.URLToken />
</cflock>

<cfoutput><cflock scope="session" timeout="10">
    <input type="hidden" name="CFID" value="#session.CFID#" />
    <input type="hidden" name="cftoken" value="#session.cftoken#" />
</cflock></cfoutput>

but when i try to run thepage i am getting error . Please help me how  to solve this error .

Thanks.

This topic has been closed for replies.

3 replies

BKBK
Community Expert
Community Expert
September 11, 2009

<cflock scope="session" timeout="10">
    <cfset myURLToken = session.URLToken />
</cflock>

<cfoutput><cflock scope="session" timeout="10">
    <input type="hidden" name="CFID" value="#session.CFID#" />
    <input type="hidden" name="cftoken" value="#session.cftoken#" />
</cflock></cfoutput>

Now, drop the locks. You don't need them in CF8, at least, not as they're applied here. Do instead


    <cfset myURLToken = session.URLToken />


   <cfoutput> <input type="hidden" name="CFID" value="#session.CFID#" />
    <input type="hidden" name="cftoken" value="#session.cftoken#" /></cfoutput>

cfnewAuthor
Known Participant
September 11, 2009

no it does not works if i removed locks, still getting errorwhen i removed locks

Element CFID is undefined in SESSION

BKBK
Community Expert
Community Expert
September 11, 2009

Navigate to the page Server Settings => Memory Variablesin the Coldfusion Administrator. Uncheck the option and check the options Enable Application Variables and Enable Session Variables. Click the button to submit the changes.

cfnewAuthor
Known Participant
September 11, 2009

when i changed this code to this code it is working, is this way is correct or i am making any mistake.

<cfoutput><cflock scope="session" timeout="10">
    <input type="hidden" name="CFID" value="#session.sessionid#" />
     <input type="hidden" name="cftoken" value="#cookie.cftoken#" />
</cflock></cfoutput>

Participating Frequently
June 12, 2009

I've seen this happen when you do a StructClear(Session). If that's

not it then we need more info: does it happen with a simple

Application.cfm file, what does your cfapplication tag look like, etc.

Mack

cfnewAuthor
Known Participant
September 11, 2009

my cfapplication tag looks like this

<cfapplication name="project"
               sessionmanagement="Yes"
               setclientcookies="Yes"
               applicationtimeout="#CreateTimeSpan(0,0,0,0)#">

Inspiring
September 11, 2009

<cfapplication name="project"
               sessionmanagement="Yes"
               setclientcookies="Yes"
               applicationtimeout="#CreateTimeSpan(0,0,0,0)#">

That's a rather low application timeout you've got there.  Do you mean to be setting it to zero?

(I can't see how this would impact your sessions, having said that)

--

Adam