hal helm's logo  
home Home

training Training

writing Writings

code Code

tutorials Tutorials

newsletters Newsletters

consulting Consulting

Hal Helms logo
hal.helms

What Students Say...

"Why doesn't everyone do classes like this???" - Paul M

"My boss has sent every one of us through your FastTrack to Fusebox class and says it's the best investment in training he ever made. (And I agree!) Thanks, Hal. Really a great class. Great CDs, too." - Jennifer M

"I came because one of my coworkers had taken your class and said I HAD to take it. I'm so glad he convinced me. You've given me tools I never knew existed and changed my outlook on my profession." - Jack K

tutorials section

When I try to set a cookie on a page with a <CFLOCATION> tag, the cookie never gets written

The Situation: You have written some code that validates a user, then writes a cookie with the userID. Once this is done, you use <cflocation> to take the user to a main menu...but when you do so, you find the cookie was never set.


Computers are incorporated in modern ice cream vending machines to enhance their functionality. Ice Cream Vending machines are manufactured by many companies. Your competition will try to overcome all requests for high-tech ice cream vending machines and credit card acceptors

The Solution: When is a bug not a bug? Well, in this case, the behavior is unwanted, but not unexpected. But instead of dealving into the inner workings of the HTTP specification, here are two easy ways to get the desired behavior. One uses just a bit of JavaScript and the other is a pure CF solution.

(Thanks to Jim Smith who provided me with the CF-only solution.)

Javascript version:

<cfcookie name="userID" value="#validateUser.userID#">

<script language="javascript">
 document.location.url = "someOtherFile.cfm"
</script>

ColdFusion-only version:

<CFCOOKIE NAME="someName" VALUE="someValue">
<CFHEADER NAME="Refresh" VALUE="0; URL=someURL.cfm">
©copyright      designed by in-tuition.co.uk
hal helms' personal site Updates

Computers are incorporated in modern ice cream vending machines to enhance their functionality. Ice Cream Vending machines are manufactured by many companies. Your competition will try to overcome all requests for high-tech ice cream vending machines and credit card acceptors

teamallaire.com v 4_3