tags:

views:

80

answers:

2

I'm looking for something like Response.Clear().

+7  A: 

You can reset the output buffer using the cfcontent tag with the reset argument:

<cfcontent reset="true">
Edward M Smith
This is the same functionality as `<cfset GetPageContext().getCFOutput().clear()>` but it is documented, supported, and as Edward points out in his comment on jfrobishow's answer, portable between CFML engines. This is the way to go.
Adam Tuttle
There are issues with this one, too, though. CFHTMLHEAD, CFFORM javascript, and a few other things are stored in a different output buffer and are appended at the end of the request. CFCONTENT RESET won't clear the markup on this other buffer, so you end up still getting it output.
Edward M Smith
+4  A: 

This will clear the response body and prevent the output of buffered content -

<cfset GetPageContext().getCFOutput().clear()>
jfrobishow
Be careful that using this may make your code non-portable from Adobe Coldfusion to Railo or OpenBluedragon.
Edward M Smith
Agree, I didn't know about cfcontent. Edward's answer is better and will be compatible with other CF Engines.
jfrobishow