4

We have several sites that use sessions to store data. They work perfectly. However, I just created a new site, and its session is reset every time a page loads. So, I can't store the user login.

We're still using application.cfm. In that I have only this:

<CFAPPLICATION
NAME="TestName1"
APPLICATIONTIMEOUT="#CreateTimeSpan(0,8,0,0)#"
SESSIONTIMEOUT="#CreateTimeSpan(0,8,0,0)#"
sessionmanagement="yes"
scriptprotect="all"
setclientcookies="yes">

In a file in the same directory as application.cfm, I have a file called sessiontest.cfm with only this:

<cfdump var="#session#" label="SESSION">
<br /><br />
<cfdump var="#cookie#" label="COOKIE">



On the first run, this is what I saw in the browser loading sessiontest.cfm:

enter image description here



On refesh, this is what I saw:

enter image description here



I can refresh in rapid succession and each refresh starts a new session. The site uses an SSL cert and is run on IIS7, although we have others with the same setup that are working fine, so I'm not sure that would make a difference. Oh, and to make it worse, this doesn't seem to happen for everybody.

Any thoughts what we can change or check to get sessions to stick?

Nick Petrie
  • 5,364
  • 11
  • 41
  • 50

2 Answers2

3

I discovered a solution that might be more of a work-around. I changed application.cfm to this:

<CFAPPLICATION
NAME="TestName1"
APPLICATIONTIMEOUT="#CreateTimeSpan(0,8,0,0)#"
SESSIONTIMEOUT="#CreateTimeSpan(0,8,0,0)#"
sessionmanagement="yes"
scriptprotect="all"
setclientcookies="no">

<cfif structKeyExists(session,"cfid")>
    <cfcookie name="cfid" value="#session.cfid#" expires="NOW">
    <cfcookie name="cftoken" value="#session.cftoken#" expires="NOW">
</cfif>

By managing the cookies myself, it seems to have solved the problem. But, I think @user1800937's answer might be the better one to actually correct the problem. I just can't try it as I do not admin the server.

Thanks for everyone's help!

Nick Petrie
  • 5,364
  • 11
  • 41
  • 50
2

We had a similar issue recently in our production environment, seems we missed to apply a hot fix from 2011 on ColdFusion 9.0.1 .similar issue can be found http://www.horisk.com/blog/index.cfm/2011/5/19/Session-issues-after-installing-Coldfusion-901-update--OnRequestEnd-behaviour-change

I applied Cumulative HotFix 4 for 9.0.1 , seems it resolved the issue for me.

http://helpx.adobe.com/coldfusion/kb/cumulative-hotfix-4-coldfusion-901.html

user1800937
  • 105
  • 1
  • +1 As I'm guessing you're probably right. We're on 9.0.1, but not sure if we're on HotFix 4 for 9.0.1. There's also a 9.0.2 available now. We're upgrading to 10, so hopefully this will be resolved with the upgrade. Meanwhile I discovered the work-around below. – Nick Petrie May 03 '13 at 15:06
  • If youvare not sure what updates u have installed, try hackmycf.com – snake May 03 '13 at 18:24