Session Variable Understanding
Posted on 2000-03-15
I am guessing I just don't understand something about session variables so bear with me.
In an APPLICATION.CFM files I set the <CFAPPLICATION> tag and identify the SESSIONMANAGEMENT as on.
Then, in that same file, I create a few session variables (like session.firstname, session.lastname...you get the idea) and default them all to "" to start off with.
Later, in a login page, I confirm a user name and password against a database, retrieve information from that record and place that data into the session variables. Which works fine (confirmed with a subsequent page for testing by outputting the session variables).
However, and this is where I think I don't fully understand the session object, when I return to the home page, I have an if clause that checks, for example, session.firstname to see if it is set to "". If it is, I say "Welcome", if it is not I way "Welcome " #session.firstname#. But it never seems to work...like there is a scoping issue with the session variable I defined.
Is that enough to get a solution to this misunderstanding?
Thanks in advance. By the way, I have looked at some of Forta's books and while I find some information about sessions I don't seem to find anything that really talks about how to use them appropriately.