Search code examples
coldfusioncoldfusion-11cflogin

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?


Solution

  • <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.