如何从用户2获取用户1的会话状态 [英] How to get Session state of user 1 from user 2

查看:81
本文介绍了如何从用户2获取用户1的会话状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我有一个场景,我需要从user2访问user1的会话状态,并根据用户1的会话状态执行一些操作(会话)状态可能处于空闲,活动或过期状态。



当用户(User1)登录网站时,我正在保存用户的会话ID应用对象。因此,当另一个用户(User2)登录到该网站时,User2可以访问User1会话ID并且应该能够知道用户1的状态并根据用户的会话状态(空闲,活动或过期)执行某些操作1.



请建议我从User2获取User1的会话状态。



注意:两个用户一次打开网站。



提前致谢。

谢谢。

Hi,

I have a scenario where I need to access session state of user1 from user2 and perform some operations according to the Session state of User 1 ( Session state may be in idle,active or expired).

When a user (User1) login in to the website, I am saving the session id of the user in "Application" object. So when another user (User2) login in to the website, User2 can access the User1 Session id and should be able to know the State of the User 1 and perform some operation according to the Session state (idle,active or expired) of user 1.

Please suggest me a way to get session state of User1 from User2.

Note: Both the users opened the website at a time.

Thanks in advance.
Thanks.

推荐答案

当User1注销时,您可以使用Clear all session。或者在创建会话之前清除所有会话:



Session.Abandon();



Session.Clear();
You can use Clear all session when User1 logout.Or clear all session before you create session like this :

Session.Abandon();

Session.Clear();


这篇关于如何从用户2获取用户1的会话状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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