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>

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy