ColdFusion SessionTracker并强制会话结束 [英] ColdFusion SessionTracker and forcing the session to end

查看:141
本文介绍了ColdFusion SessionTracker并强制会话结束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用ColdFusion 9 coldfusion.runtime.SessionTracker 使用以下代码监视当前登录的用户。

I'm using the ColdFusion 9 coldfusion.runtime.SessionTracker to monitor currently logged in users using the following code.

app = application.getApplicationSettings().name;
sessiontracker = createObject("java","coldfusion.runtime.SessionTracker");
sessionCollection = sessionTracker.getSessionCollection(app);

这会返回 struct $ c> jsessionid 和所有当前活动会话的会话变量。

Which returns a struct of jsessionid's and the session's variables for all the currently active sessions.

有可能强制一个会话结束,因为我有 jsessionid 有效地强制用户注销?

Is it possible to force a session to end given I have the jsessionid effectively forcing the user to be logged out?

感谢,

Richard

推荐答案

所以当用户登录时,我在他们的会话中设置了一个用户结构,以便删除他们的登录状态。使用 sessionTracker 我可以获得特定用户的会话,只需删除他们当前会话中的用户结构即可。

So when a user logs in I'm setting a user structure in their session, so to remove their logged in state. Using sessionTracker I can get a specific user's session and just delete the user structure in their current session.

app = application.getApplicationSettings().name;
sessiontracker = createObject("java","coldfusion.runtime.SessionTracker");
sessionCollection = sessionTracker.getSessionCollection(app);

userSession = sessiontracker.getSession(app, sessionID));

structDelete(userSession, "user");

不知道这是否是最好的方法,但似乎对我有用。希望它帮助人们。

Not sure if this is the best way of doing it but it seems to work for me. Hope it helps people.

这篇关于ColdFusion SessionTracker并强制会话结束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆