Robin
Robin

Reputation: 91

What's the best way to logout with ColdFusion?

cflogout does not seem to clear the CFID and CFTOKEN values. Is cflogout only used with cflogin?

In this instance, I am not using cflogin. I am setting session variables because of the issues with cflogin. It worked before CF11 Update 7, however, CF11U7 seemed to resolve the cflogin double issue. Anyone else?

Is this all that I need? If so, it's not working.

<cfset structDelete(session, "CFTOKEN")>
<cfset structDelete(session, "CFID")>

What is the best way to logout using ColdFusion?

Upvotes: 1

Views: 2299

Answers (3)

mtbrown
mtbrown

Reputation: 126

<cfset sessionInvalidate()>

This function will not only clear the session scope, but also invalidate the CFID/CFToken.

Upvotes: 5

Darth Guybrush
Darth Guybrush

Reputation: 36

<cfscript>
    StructClear(Session)
</cfscript>

This will delete ALL session variables.

(1)

<cfscript>
    StructDelete(Session.MySessionVariable)
</cfscript>

(2)

<cfscript>
    StructDelete(Session, "MySessionStructure")
</cfscript>

Will delete a specific variable (1) or structure(2) in the session scope.

Upvotes: 2

Umair Khan
Umair Khan

Reputation: 283

<cfset StructDelete(SESSION,"user")>

Here user is the structure that i made during the login

Upvotes: 2

Related Questions