This content has been marked as final. Show 5 replies
The comparison "if s eq form.sessionid" seems okay. But I would remove s instead from the sessions structure, thus
<cfloop collection="#sessions#" item="s">
<cfif s eq form.sessionid>
StructDelete(Sessions, s, "True");
Ok tried modifying my script with suggested code and it executes without error, but the session is not deleted... Any additional suggestions or clues?
the session is not deleted
hmm, interesting. I can confirm what you observed. However, the following identical code does work:
I therefore suspect Coldfusion will not allow you to delete such system structures just like that. I'm looking into it.
When you say that you're trying to write an app that lets an admin remove a session does that mean that you want to remove a variable from the session scope, clear the session scope of its contents, delete the session scope itself, or logout the user ?
Deleting a variable from the session scope is possible with StructDelete(). Clearing the session scope of all its variables is possible with StructClear(). I don't believe it's possible to delete or remove the session scope for a user if sessions are turned on in the cfapplication tag. Forcing a user to loggout may be possible using the <cflogout> tag depending on how your system is set up.
I am trying to create a dashboard application that will work within any in house cf applications and funciton in the following manner.
1. Allow the application administrator to view users who are logged in to app with a session.
2. Allow the administrator a method to forcefully remove (or logout) user from application if necessary and clear memory on server.
I realize that I can get the session collection at two different levels using two different methods...
I am just having difficulty manipulating the values in the structs or deleting them.
I see an additional method of cleanup() in the object SessionTracker. Has anyone used this method?
Any snippets on how it works?