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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Session variable dying prematurely 1

Status
Not open for further replies.

calista

Programmer
Jan 24, 2001
545
US
I'm having a strange problem with my session variable. On certain pages, I CFINCLUDE a "Gatekeeper" that checks to see if the user is logged. If not, a login form is presented, the user logs in, and is then sent to whatever page he was trying to get to. In the process, I set a session variable to the userID. This is working fine out on my real intranet website.

Now, here's the strange part. I downloaded the site onto my workstation to make some updates. I soon found out that although my session varible was being set during the login process, as soon as I left that first page after logging in, the session variable was gone. In case you think I did something in the process of making updates, I downloaded the site again(into an empty folder), and before changing anything, I tested it. It didn't work. The same code that is working on the "real" website is not working on my workstation. What's going on here? Calista :-X
Jedi Knight,
Champion of the Force
 
I'm still having this problem, and I am reluctant to upload changes until I understand what is happening. Anybody have any ideas? Please?!! Thanks!!! Calista :-X
Jedi Knight,
Champion of the Force
 
Hey Calista,

What are your settings in the CF admin for session variable timeout? I would first check to make sure that the default timeout isn't set to something low like a few seconds. I'm guessing this isn't the problem but it's the first place I check. The next thing I would check is to see whether your browser has cookies turned on. If they aren't, you will lose the session if you don't pass the Cfid & Cftoken in all of your links. If neither of these are the case, pleas post your cfapplication tag and I can give you a few places to check next.

Good luck,
GJ
 
The timeout is set for 20 min in CF Admin. Cookies are turned on. Here is my CFAPPLICATION tag.
Code:
<CFAPPLICATION NAME=&quot;TLGD_Intranet&quot;
               CLIENTMANAGEMENT=&quot;Yes&quot;
               SESSIONMANAGEMENT=&quot;Yes&quot;
               SETCLIENTCOOKIES=&quot;Yes&quot;
               SESSIONTIMEOUT=&quot;30&quot;
               APPLICATIONTIMEOUT=&quot;30&quot;
               SETDOMAINCOOKIES=&quot;Yes&quot;>
I am becoming suspicious that this is NOT a CF problem. I began to have the same problem with the internet in general. For example, checking my Yahoo mail, it soon asks me to login again because my session has expired. I uninstalled and reinstalled IE 5.5, and that seemed to solve that problem, at least for now. I also uninstalled and reinstalled CF Studio and Server on my workstation, but it still doesn't work. Calista :-X
Jedi Knight,
Champion of the Force
 
Hey Calista,

I'm not sure if this will fix your problem or not but I would try it first. Your sesstionTimeOut and applicationTimeOut attributes need to be set with the createTimeSpan function like this:

sesstionTimeOut=#CreateTimeSpan(days, hours, minutes, seconds)#
applicationTimeOut=#CreateTimeSpan(days, hours, minutes, seconds)#

which in your case would be this:

sesstionTimeOut=#CreateTimeSpan(0,0,30,0)#
applicationTimeOut=#CreateTimeSpan(0,0,30,0)#

Let me know if this doesn't fix it.

GJ
 
I tried just deleting them from CFAPPLICATION, since the default in Admin is OK, and it still doesn't work. I don't understand why the same code that worked before no longer does. It's just on my machine. If I access the intranet through my brower, it works fine. Only when I try to browse my local copy through Studio, do I have a problem. I'm so confused! X-) Calista :-X
Jedi Knight,
Champion of the Force
 
Hey Calista,

Looking at your code again, I realize I missed the &quot;setdomaincookies&quot; attribute the first time. I've never used this one before but after reading the docs on it, I would guess that this could potentially affect the application's behavior between your Intranet cluster and your laptop. I would set this to &quot;no&quot; and see if the problem persists.

If this doesn't change the problem, put this code below in a separate directory with an application.cfm file that is blank. Use Netscape to test this as I've seen IE cache dynamic pages before when it shouldn't which makes troubleshooting session problems more difficult.

<CFAPPLICATION NAME=&quot;TLGD_Intranet&quot; CLIENTMANAGEMENT=&quot;Yes&quot; SESSIONMANAGEMENT=&quot;Yes&quot; SETCLIENTCOOKIES=&quot;Yes&quot;>

<cfif not isdefined(&quot;session.var1&quot;)>
<cfset session.var1 = timeformat(now(),&quot;hh:mm:ss&quot;)>
</cfif>

<cfoutput>
#session.var1#<p>
<a href=&quot;#cgi.script_name#?cfid=#cfid#&cftoken=#cftoken#&quot;>Reload</a>
</cfoutput>

First, load the page and note the time. Then reload the page several times and see if the time ever changes. If it doesn't, then your session variables should be working fine. If the time does change between reloads, this means your session variables are not &quot;sticking&quot;. In this case, click the link at the bottom and see if the time still changes. If it does, this would mean something very unusual is wrong. If however, the time doesn't change, this would indicate that your browser isn't sending the cookie variables that maintain session state.

If the time doesn't change when do the first reload, this means that your session variables are working. I would then move this test script to the directory where you're seeing the problem. Remove the <cfapplication> tag from the top (I'm assuming this is in your application.cfm file) and do the testing again. If you see different behavior, it would appear that you have a problem in your application.cfm and probably the <cfapplication> tag.

Let me know what happens,
GJ
 
I deleted &quot;SETDOMAINCOOKIES&quot;, and that solved the problem! :-D My only theory on why this used to work on my machine and then stopped working is I went from IE 5.0 to 5.5. A couple of weeks ago, my workstation crashed, and MIS had to take my box and try to restore it. They did, (no data loss, thank heaven!) and when they returned my box, it had IE 5.5 on it. I asked them if they had upgraded it, and they said no. According to them, I still have 5.0(But, what do they know?). I'm actually not sure when I got 5.5. I didn't load it myself, so I figure they must have done in the process of restoring my machine.

Anyway, it seems OK, now, at least until tomorrow when they bring our upgraded firewall online. We've already been notified that we will have to reconfigure our browsers. But, tomorrow is another day!

Thanks for everthing! Calista :-X
Jedi Knight,
Champion of the Force
 
Glad I could help.

Hehe, you really have to watch those IT guys, I know as I used to be one ;)

GJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top