• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1412
  • Last Modified:

coldfusion -Element CFID is undefined in SESSION

Hello experts
I'm trying the code from this tutorial:http://www.bennadel.com/blog/730-Testing-ColdFusion-Session-Cookie-Acceptance.htm but i get the error:Element CFID is undefined in SESSION

Any help?
<cfsilent>
  <cfparam name="URL.id" type="string" default="" />
	<cfif (ListLen( URL.id ) LT 5)>
		<cfset URL.id = ListAppend(URL.id,"#SESSION.CFID#-#SESSION.CFTOKEN#")>
		<cflocation url="#CGI.script_name#?id=#URL.id#" addtoken="false"/>
    </cfif>
    <cfset arrID = ListToArray( URL.id ) />
</cfsilent>
<cfoutput>
 
	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
	<html>
	<head>
		<title>ColdFusion Session Cookie Test</title>
 
		<style type="text/css">
 
			p.confirm {
				background-color: ##F9FBFF ;
				border: 2px solid ##6699FF ;
				font-size: 28px ;
				padding: 20px 0px 20px 0px ;
				text-align: center ;
				}
 
		</style>
	</head>
	<body>
 
		<h2>
			ColdFusion Session Cookie Test
		</h2>
 
		<p>
			In order for you to be able to log into
			this site, you must have Cookies enabled in
			your browser. If cookies are enabled, the
			following 5 values will be identical:
		</p>
 
 
		<ol>
			<!--- Loop over values and output them. --->
			<cfloop
				index="intI"
				from="1"
				to="5"
				step="1">
 
				<li>
					#arrID[ intI ]#
				</li>
 
			</cfloop>
		</ol>
 
 
		<p class="confirm">
 
			<strong>Cookies Accepted:</strong>
 
 
			<!---
				We will know that the session cookie
				information held from request to request
				if all the values in the list are identical.
				Check each value against the next.
			--->
			#YesNoFormat(
				(arrID[ 1 ] EQ arrID[ 2 ]) AND
				(arrID[ 2 ] EQ arrID[ 3 ]) AND
				(arrID[ 3 ] EQ arrID[ 4 ]) AND
				(arrID[ 4 ] EQ arrID[ 5 ])
				)#
		</p>
 
		<p>
			If your cookies are not being accepted, please
			copy and paste the contents of this page into an
			email and send it to nikki@girls-like-girls.com.
		</p>
 
 
		<!---
			Output some browser related information that
			might help the tech team debug just what is
			going on.
		--->
 
		<h3>
			Browser Information
		</h3>
 
		<p>
			<strong>User Agent:</strong><br />
 
			#CGI.http_user_agent#
		</p>
 
		<p>
			<strong>Request Cookies:</strong><br />
 
			<!---
				When outputting the browser's cookie, just
				try to replace out references to CFIDE and
				ADMINISTRATOR (if they are there) so people
				don't get any funny ideas.
			--->
			#ToString( CGI.http_cookie ).ReplaceAll(
				"(?i)cfide|administrator|cfadmin",
				"temp"
				)#
		</p>
 
	</body>
	</html>
 
</cfoutput>

Open in new window

0
Panos
Asked:
Panos
  • 3
  • 2
1 Solution
 
_agx_Commented:
Sounds like you haven't enabled session variables or there's no Application.cfc/cfm file in that script's path.

0
 
PanosAuthor Commented:
Hi agx.
This is a part of my application.cfm
<cfapplication
      name="blabla"
      applicationtimeout="#CreateTimeSpan( 0, 1, 0, 0 )#"
      sessionmanagement="yes"
    scriptprotect="all"
    setdomaincookies="no"
    setclientcookies="yes"
    clientmanagement="Yes"
      sessiontimeout="#REQUEST.SessionTimeout#"
      />
0
 
_agx_Commented:
Then you're probably using J2EE session variables which uses sessionid not CFID and CFTOKEN.  
0
 
_agx_Commented:
I haven't read the whole article. But I'm guessing it should work if you change this
<cfset URL.id = ListAppend(URL.id,"#SESSION.CFID#-#SESSION.CFTOKEN#")>

... to
<cfset URL.id = ListAppend(URL.id,"#SESSION.sessionid#")>
0
 
PanosAuthor Commented:
Yes agx.
The problem was the J2EE session. I did check this in the coldfusion admin and than forgot to uncheck it.
Thank you.
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now