ColdFusion sometimes drives me a bit wonky when I try to set a dynamic variable inside a tag. Most ColdFusion tags support embedded dynamic variables, but quite a few tags don't support this. Probably the most frustrating issue is when you want to use a dynamic variable to extend an application in a sub-folder using two or more application.cfc templates. It seems that every other time I do this I slap my head and think 'Oops! it's time to set up proxy extensions, sigh... but this frustrating issue requires a very long blog entry for a different day. Back to my point... If you try to use a dynamic variable using a cfcookie tag, you will get the following nasty error:

<cfcookie name="isAdmin" value="true" path="#application.baseUrl#" expires="never"></cfcookie>

Attribute validation error for tag CFCOOKIE. It has an invalid attribute combination: expires, name, path, value. Possible combinations are: Required attributes: 'name'. Optional attributes: 'domain, encodevalue, expires, httponly, preservecase, secure, value'. Required attributes: 'domain, name, path'. Optional attributes: 'encodevalue, expires, httponly, preservecase, secure, value'. To get around this, simply use the cookie scope instead to set the dynamic path value.

<!-- Using the cfcookie tag does not work with dynamic vars in the path. --->
<cfset cookie.isAdmin="{" value="true" ,="" path="#application.baseUrl#" expires="30" }=""/>

Both cfcookie and the cookie scope do the same thing, send a cookie to the client, but at least the cookie scope allows you to embed dynamic variables in the path name.