CFLib.org – Common Function Library Project

HTTPHeader([name][, value][, statuscode][, statustext])

Last updated September 20, 2002

author

Kreig Zimmerman

Version: 1 | Requires: CF6 | Library: CFMLLib

Description:
Mimics the CFHEADER tag. Allows you to pass a name/value pair or a statuscode/statustext pair.

Return Values:
Returns nothing.

Example:

<cfscript>
  HTTPHeader(name="Content-Type", value="text/html; charset=iso-8859-1");
  HTTPHeader(name="Content-Language", value="EN-US");
</cfscript>

Parameters:

Name Description Required
name Name used when passing name/value pairs. No
value Value used when passing name/value pairs. No
statuscode Status code used when passing statuscode/statustext pairs. No
statustext Status text used when passing statuscode/statustext pairs. No

Full UDF Source:

<!---
 Mimics the CFHEADER tag.
 
 @param name      Name used when passing name/value pairs. (Optional)
 @param value      Value used when passing name/value pairs. (Optional)
 @param statuscode      Status code used when passing statuscode/statustext pairs. (Optional)
 @param statustext      Status text used when passing statuscode/statustext pairs. (Optional)
 @return Returns nothing. 
 @author Kreig Zimmerman (kkz@foureyes.com) 
 @version 1, September 20, 2002 
--->
<cffunction name="HTTPHeader" output="false" returnType="void">
    <cfargument name="name" type="string" default="">
    <cfargument name="value" type="string" default="">
    <cfargument name="statuscode" type="string" default="">
    <cfargument name="statustext" type="string" default="">
    <cfif Len(name) and Len(value)>
        <cfheader name="#name#" value="#value#">
    <cfelseif Len(statuscode) and Len(statustext)>
        <cfheader statuscode="#statuscode#" statustext="#statustext#">
    </cfif>
</cffunction>

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson