Tricky Coldfusion Cookie Question
Posted on 2012-09-04
I have a quick question about the setting and use of a cookie.
Let say I have a variable 'cname' which I set value as '12345'
To create a 'dynamically' named cookie, I combine the 'cname' variable to the cookie creation tag(See code lines below)
<cfset cname = '12345'>
<cfcookie name="super#cname#" value="999" expires="1">
The question I have here is, how do I access the value of the dynamicly named cookie?
Normally to access the value of a cookie, we call it like thus:
But in the above example, how do I access the value of the 'dynamically' named cookie with a value of 999?
If I accessed the cookie using the method below, it will work, but I want to place the dynamic call to the cookie without hardcoding the '12345' into the call.
How do I somehow call the cookie value above with the dynamic name inside like below without an error?
Is this possible?
(I know that I can create the cookie and place the 'dynamic' value right inside the value ="" spot, but I want to be able to name a cookie dynamically as I want the cookie to have a unique name for keeping track purposes)