Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Session Variables Not Creating

Status
Not open for further replies.

scripter73

Programmer
Apr 18, 2001
421
US
Hi,

I have been programming with CF for a while, and haven't seen anything like the following.

I have a registered domain name that was parked with registrar A. Meanwhile, I was searching for a web host that hosted CF and found them.

I pointed my information on registrar's A's site to point to the IP address of my CF web host.

I'm able to create CF pages on my web host, but I did domain masking, so no matter what page the user clicks on, the address bar always shows
Now, I was getting to the stage in my development where I wanted to use session vars.

I have made sure I have an application.cfm in my \ page where sessionmanagement and clientmanagement are enabled, but in my pages, wherever I say: <cfset session.variable = "<something>">, I get nothing.

I also have a script that I can use to see what session vars have been created, and I don't see that they're even getting created. I see the ID and Token is created and it looks ok. The only time one does get created is if I initialize it first in the application.cfm. Even then, the variable doesn't keep a value, its just blank.

The site hosts CF MX, and I was reading on Macromedia's site where you should enclose all code that uses session vars with a <cflock>. I've never had to do this before.

Since I can't get to the Administrator directly, is there something I'm missing with the updated version of MX. Does it have to do with my domain masking, etc.

Any help is greatly appreciated.

Thanks,
scripter73


Change Your Thinking, Change Your Life.
 
Sounds like you may have another application.cfm file floating around out there somewhere. Remember, CF is going to use the first application.cfm file it comes to. Check with your host and make sure they allow Session management. I think if they have it turned off, you would be getting an error. But they may have done something like set the default server timeout to zero to keep anyone from using sessions. It sounds crazy, but you never know...



Hope This Helps!

Ecobb

&quot;My work is a game, a very serious game.&quot; - M.C. Escher
 
Application.cfm gets called everytime a page loads. Make sure to check if the session variable is defined first then set its default values.

<CFIF ISDEFINED("SESSION.VARIABLENAME")>

---- Nothing to do here.. already there

<CFELSE>

---- CFSET the vars here..

</CFIF>

In previous version of CF you needed to use CFLOCK to Lock the session to write to session variables. This was to prevent multiple accesses and writes to over step each other.
 
I'm ashamed to have a possible answer to this, ashamed because of how long it took me to find it.

I had an issue with one website where client variables absolutely refused to set, everything I tried.. nothing worked..

I couldn't even say:

Code:
[b]clientfile.cfm[/b]:
--------------
<cfset client.xname="Tony">
<cfinclude template="clientdisp.cfm">

[b]clientdisp.cfm[/b]:
--------------
<cfoutput>#client.xname#</cfoutput>

The problem was my cfapplication tag.. I did not have a name set for it.

You *have* to set a name when using CFAPPLICATION.

ALFII.com
---------------------
If this post answered or helped to answer your question, please reply with such so that forum members with a similar question will know to use this advice.
 
Thanks, webmigit, but I already have a "name" attribute set in my <cfapplication> tag as you mentioned.

Thanks, too, wbochar, I haven't had to do that before (although I did entered the IsDefined in some of my code). I'll try it again and let you know.

Thanks for all of your responses.

scripter73


Change Your Thinking, Change Your Life.
 
I didn't see your post until now Ecobb. I was thinking something like that may be happening. I'll talk with them again and find out. I'll keep you posted.

Thanks for your advice.

scripter73


Change Your Thinking, Change Your Life.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top