Problem with sessions

Session variables change each time a user refreshes or clicks a link

Page 1 of 1

3 Replies - 826 Views - Last Post: 12 October 2010 - 07:10 AM Rate Topic: -----

#1 cyb1n  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 3
  • View blog
  • Posts: 27
  • Joined: 08-May 09

Problem with sessions

Posted 12 October 2010 - 06:16 AM

I'm working on a project with a tight deadline. The site is a fairly simple statistics reporting site. I've been reusing code from another project that we had great success with since we're on such a tight deadline, but there's one issue I can't figure out. The new site has a single folder that will require a login to access, unfortunately my login won't work because every request (be it refresh, link, or form post) creates new session variables. I've been over my code several times and I can't seem to figure it out. Has anyone else had an issue with this?

Is This A Good Question/Topic? 0
  • +

Replies To: Problem with sessions

#2 Craig328  Icon User is offline

  • I make this look good
  • member icon

Reputation: 1926
  • View blog
  • Posts: 3,471
  • Joined: 13-January 08

Re: Problem with sessions

Posted 12 October 2010 - 06:28 AM

I've seen it happen. It can be one (or a combination) of a couple of things.

Sessions require that the user's browser accept cookies or that the CFID and CFTOKEN get passed along as URL variables if the browser doesn't accept cookies. Sometimes, if the browser is accepting cookies but you have something else running (like a particularly aggressive antivirus program) you could be wiping out the cookies and the CF server sees each new request as a new session.

You could also be setting the session timeout too low. The default is 20 minutes so you may have done something somewhere to reset that. Another, much less common symptom can be that the server is out of memory. This is not something you'd expect to see on CF8 or 9 as the memory allocation adjusts itself but it was known to rarely happen on older versions of CF.

One way to troubleshoot it is, at the top of your page, do a CFDUMP of the session (or the struct you're storing the login status in the session if you're doing that). Keep an eye on the CFID and CFTOKEN values. They should be static for each session. If they're changing at each page request, you're losing your session somehow.

Try that first. If you've trying that and still can't nail it down, post your Application.cfc and your login form and process pages here and I'm sure we can get you squared away.

Good luck!

This post has been edited by Craig328: 12 October 2010 - 06:38 AM

Was This Post Helpful? 1
  • +
  • -

#3 cyb1n  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 3
  • View blog
  • Posts: 27
  • Joined: 08-May 09

Re: Problem with sessions

Posted 12 October 2010 - 07:08 AM

Thanks for the advice, I scanned back through the Application CFC and noticed that apprently one of my coworkers changed the this.ClientCookies to false in the Application CFC.
Was This Post Helpful? 1
  • +
  • -

#4 Craig328  Icon User is offline

  • I make this look good
  • member icon

Reputation: 1926
  • View blog
  • Posts: 3,471
  • Joined: 13-January 08

Re: Problem with sessions

Posted 12 October 2010 - 07:10 AM

There ya go. Glad to hear you nailed it down.

Make sure you ask the co-worker why they did that. While re-enabling it may solve your problem, it may be wrecking something for them.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1