CFLib.org – Common Function Library Project

SessionClear()

Last updated August 06, 2004

author

Robby Lansaw

Version: 1 | Requires: CF5 | Library: UtilityLib

Description:
Allows you to 'structclear' an entire session without worrying about deleting ColdFusion's built in variables.

Return Values:
Returns nothing.

Example:

... populated session
<cfset sessionClear() />
... cleaned session

Parameters:

No arguments.

Full UDF Source:

/**
 * Allows you to 'structclear' an entire session without worrying about deleting ColdFusion's built in variables.
 * 
 * @return Returns nothing. 
 * @author Robby Lansaw (robby@ohsogooey.com) 
 * @version 1, August 6, 2004 
 */
function sessionClear(){
    var dont_clear = "sessionid,cfid,cftoken,jsessionid,urltoken";
    var key = "";
    for(key in session) {
        if(not listFindNoCase(dont_clear, key)) structDelete(session,key);
    }
}

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