Greg's Blog

helping me remember what I figure out

Cookies and Structures

| Comments

I was playing around with setting cookies in the Mach-ii framework and kept finding that even tough my cookie was showing up as set in the debug output when I did a StructKeyExists check it returned no. After some head scratching, I realised that, and this is not only specific to Mach-ii, I assumed that by setting a cookie with a value of cookie.searchPref.pref1 I had created a nested structure searchPrefs with a key of pref1. In actual fact I had created a key in the cookie structure called searchPref.pref1. So the check should really have been:

StructKeyExists(cookie,”searchPrefs.pref1”)

And bingo I was now reading the values stored in the cookie rather than from my application constants.