Im trying to set a cookie just before doing a cflocation but the cookie is never set. Why is this?
cfcookie and cflocation both write header information to the client. As ColdFusion doesn’t send out any information until after a page request has completed processing, the cflocation being the last header-writing part of your template gets to write to the header, overwriting anything that cfcookie had prepared to write. As a workaround, you could set the cookie using ColdFusion and then use the JavaScript location.href to redirect the browser.