[Webinar] Streamline your web hosting managementRegister Today

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

Session Variables not set

I did write two CF applications and have the same problems with both.
I use session-variables (correctly initialized in APPLICTAION.CFM)
In about 85% to 95% of the user session, the variables are set correctly; in the resting 5%-15%, session-variables stay in default value and are not set.
I already tried to set all cfset-tatements for session-variables in a <cflock>: No effect
Any Ideas?
1 Solution
OK, so you've correctly enabled the use of session variables with the <CFAPPLICATION> tag in application.cfm?

SessionManagement = YES>

You said that the session variables are not being set or updated

"session-variables stay in default value and are not set"

and I've seen this before when the session variables haven't yet timed out. For example, in many applications you set a number of session variables when a user logs in to your site. You login action page will set those session variables only if the user provides a valid username and password.

Well, if they log in successfully and set the session variables, they will still have access to the site until those session variables expire on the server, even if they leave the site, return and log in again with an invalid username and password.

You can set a timespan with the <CFAPPLICATION> tag which overrides any defaults that may be set in the CF Administrator.


(0,0,30,0) means days, hours, minutes, seconds.

I'm not sure if this is similar to the situation that you are encountering, but if it's totally different, post an explanation and we'll go from there.

Good Luck,
da2121Author Commented:
Thank you for your Message; you find my application.cfm enclosed.
Unfortunately it's not that easy.
I already tried different things:
Firts, I had all cfset statements for session-variables in small pages and used cflocation at the end of the page to go to the "real" pages.
Session Variables were reproducably not set in NS 4.0x.
Then I put the cfset-statements for session-variables into the HTML.
Worked better, but not reliable.
I put all cfset statemenst in a cflock-divivsion (didn't help).
Are session-variable problematic within Framesets?

Thanks for further advise.
<cfapplication name="WebContacts"

<cfparam name="Session.PubID" default="0">
<cfparam name="Session.ThreadID" default="0">
<cfparam name="Session.MessageID" default="0">

<cfparam name="Session.ClientEmail" default="none">
<cfparam name="Session.ClientPseudonym" default="none">
<cfparam name="Session.ClientLogin" default="none">
<cfparam name="Session.ClientPasswort" default="none">
<cfparam name="session.ClientPhoto" default="noPhoto.gif">

<cfparam name="Session.ReplyerEmail" default="none">
<cfparam name="Session.ReplyerPseudonym" default="none">
<cfparam name="Session.ReplyerAnnonceStatus" default="0">
<cfparam name="Session.ReplyerAutoLogin" default="none">

<cfparam name="Session.MidiTitel" default="none">
<cfparam name="Session.MidiFile" default="none">
<CFERROR TYPE="REQUEST" TEMPLATE="errorRequest.cfm" MAILTO="mail@webcontacts.ch">
<CFERROR TYPE="VALIDATION" TEMPLATE="errorValidation.cfm" MAILTO="mail@webcontacts.ch">
To answer the last part of you final comment, YES there are some issues with session variables in framesets with certain browsers. A number of threads on this topic can be found in the Forums at www.allaire.com.

To quickly summarize our experiences with this issue, many people say that starting with IE4 the problem because quite apparent. We have seen increased reliability if the IE user has install the 3725.exe patch available from Microsoft. Our experience shows that this is NOT a complete fix, especially for an Internet environment.

After many late hour discussions with a number a well respected authorities on CF, we made the determination to not use session variables as the is no known "100%" sure way of utilizing them. With this in mind, we then moved to application and client variables. Using a combination of the two, we can perform all tasks previously handled by session variables.

Good Luck,


Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

da2121Author Commented:
Thanks again for your post; it's bad news to me, as I have several applications done with session variables.
Right know, I'm not quite sure how to implement the same funtionality based on application- and client-variables.
Would be very glad for some additional information; we have some real problems on one applictaion and need to find a workaround soon.



Make sure that your Netscape browser is accepting cookies.  If the CFTOKEN and CFIDE cookies are not being set, it would explain the behavior you describe.  Every time the browser requested a new document, the variables would be reset to their default values.

Tim R.

If you can tell me exactly what functionality is needed (why session vars) I will try to assist.

You can set a timeout value for client variables just as you did with session. The hardest part is removing the right client variables once the user is "logged out" of the application.

Also, as far as framesets go, one of the big problems is the CFID and CFTOKEN getting "lost" (I just love browser wars. <G>). It's always a good idea to pass the values of both these variables in any CF application to ensure that the state is maintained. They can be passed as hidden form or url vars.


Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

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