[thelist] cold fusion cookie question

Chris Evans chris at fuseware.com
Tue Jul 24 14:04:27 CDT 2001


Here's a couple more insights.  If you don't specify a domain, the cookie
will be set at whatever domain the user is at.  This works fine under normal
circumstances - if I go to rudy.ca and poke around, and you don't specify
domain, I'll get cookies specified there.  However, if you do redirects to
www.rudy.ca, I lose that cookie information.  Or, if you set permanent
cookies, and I switch between domains manually, I toss my cookies.

Another issue that is CF specific: you can't set a PATH attribute if you
don't set a DOMAIN attribute.

I get around this by putting in a little snippet of code which checks your
domain. If it doesn't match my "preferred" domain, I redirect you back to
the same page on the preferred domain, where all my cookies live in peace
and harmony.

For example, you could dump this in your Application.cfm:
<CFIF SERVER_NAME IS NOT "www.rudy.ca">
	<CFLOCATION URL="http://www.rudy.ca#CGI.SCRIPT_NAME#?CGI.QUERY_STRING#">
</CFIF>

Hope that helps,

Chris Evans
chris at fuseware.com
http://www.fuseware.com







More information about the thelist mailing list