如何杀死其他用户的会话 [英] how to kill other user's session

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

问题描述

假设我有web应用程序。有许多用户登录和访问一些受限制的内容。我想管理员将有权踢任何用户,因此该用户将无法访问该网页的该受限制内容。在这种情况下,如果管理员可以杀死任何特定用户的会话那么这将是可能的。所以请在asp.net告诉我怎样才能有力地杀死其他会话时,我会是不同的。如何设计这种类型的使用Web表单技术的Web应用程序。请指点。

suppose i have web app. where many user login and access few restricted content. i want admin will have power to kick out any user and as a result that user will not be able to access that restricted content of the page. in this scenario if admin can kill session of any particular user then it would be possible. so please tell in asp.net how i can forcefully kill other session when my session is different. how to design this type of web apps using web form technology. please advice.

感谢

推荐答案

您不能杀死其他会话。

您的能有什么的做的是保存在一些全球范围内(应用程序,文本文件或数据库)当前登录用户的所有列表并启用管理员添加全局旗帜为每个大关该用户为禁用,然后才显示受限制的内容,此外,如果用户登录确保他没有被标记检查。

What you can do is save in some global context (Application, Text file or Database) the list of all currently logged in users and enable the admin to add global "flag" for each that mark that user as "banned" then before showing restricted content, in addition to checking if user is logged in make sure he's not flagged.

使用应用程序级别的变量是最简单的方法,假设你没有成千上万的用户在同一时间,你可以在在session_start事件的Global.asax 在Session_End中的事件删除它们。存储用户作为普通的列表<字符串方式> ,并有单独的列表持标记/禁用用户

Using Application level variable is the most simple way assuming you don't have thousands of users in the same time, you can add users in the Session_Start event in global.asax and remove them in Session_End event. Store the users as ordinary List<string> and have separate list holding the "flagged/banned" users.

希望的逻辑是很清楚,让我知道如果你需要帮助实现它。

Hope the logic is clear enough, let me know if you need help implementing it.

这篇关于如何杀死其他用户的会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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