User Guide Cancel

SessionInvalidate

 

Description

Invalidates or cleans up the current session.

Note: The sessionInvalidate() method does not invalidate the underlying J2EE session.

Returns

None

Category

Display and formatting functions

Syntax

sessionInvalidate()

See also

SessionRotate

History

ColdFusion 10: Added this function.

Parameters

None

Usage

Use this function to invalidate the existing session.

Example

Application.cfc

<cfcomponent>
<cfset this.sessionManagement = true />
<cfset this.name = "session_app" />
</cfcomponent>

sessionInvalidate.cfm

<cfif isDefined("url.invalidate") >
<cfset sessionInvalidate()/>
</cfif>
<cfif isDefined("url.name") >
<cfset session.name = url.name />
</cfif>
<cfdump var="#session#" label="SESSION">
<cfoutput>
<a href="sessionInvalidate.cfm?name=BOB">Set session.name = BOB </a> <br/>
<a href="sessionInvalidate.cfm?invalidate=TRUE">Invalidate the session</a>
</cfoutput>

Get help faster and easier

New user?