Skip to main content
Andelo13
Participant
June 4, 2014
Question

Losing cookie data

  • June 4, 2014
  • 3 replies
  • 250 views

I've inherited a ColdFusion site (CF5), despite no background in CF, but have been tasked with making a change to the behavior of the site. I'm running into a problem with cookies, though.

A site on another domain is linking to this site and includes a query string. Now I'm checking for that value (a zip code) in the index.cfm file and storing it in the cookie and that seems to be working fine. I looped through the cookie collection and dumped the results, and the zip code was there. So at this point, all is well.

But then the user clicks on a button, which reloads the index.cfm file with a different <include>, and the cookie no longer has any values other than CFID and CFTOKEN. This was confirmed by looping through the cookie collection, and later by Fiddler.

Client storage is set to cookie, and I can't find anywhere in the index.cfm, application.cfm, or the included files where the cookie is being set to expire.

Here's the line that's storing the value:

     <cfcookie name="ZC_Zip" value="ZC.ZC_Zip#" expires="NEVER">

What else should I be looking for to figure this out?

    This topic has been closed for replies.

    3 replies

    BKBK
    Community Expert
    Community Expert
    June 4, 2014

    Could it just be that, when the button is clicked, index.cfm is reloaded without the zip-code in the query-string?

    BKBK
    Community Expert
    Community Expert
    June 4, 2014

    Andelo13 wrote:

         value="ZC.ZC_Zip#"

    A typo, surely.

    Andelo13
    Andelo13Author
    Participant
    June 4, 2014

    BKBK wrote:

    Andelo13 wrote:

         value="ZC.ZC_Zip#"

    A typo, surely.

    Correct.  I went back to the original file to be sure, and it has value="#ZC.ZC_Zip#".  Good eye though.

    BKBK
    Community Expert
    Community Expert
    June 4, 2014

    Clicking on the button might be breaking the session. To verify, jot down the values of CFID and CFToken at the point where you loop through the cookie collection. Compare them with the respective values after the button is clicked. What do you get?

    Andelo13
    Andelo13Author
    Participant
    June 4, 2014

    According to Fiddler, the values for the CFID and CFToken never change.

    BKBK
    Community Expert
    Community Expert
    June 4, 2014

    Just as well the values remain the same. Then, at least, session is maintained.

    Could it just be that, when the button is clicked, index.cfm is reloaded without the zip-code in the query-string?