如何在应用程序范围内获取所有登录用户? [英] How can i get all login users in application scope ?

查看:81
本文介绍了如何在应用程序范围内获取所有登录用户?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在欢迎用户页面上获取所有登录用户列表。因此,每个用户都可以看到登录用户列表。因为我在登录页面中创建了会话[" username"],之后我想使用它sesion会话启动方法的asax和我想检索所有登录用户并将其存储到应用程序范围,我也想删除和插入登录和注销页面上的用户。所以我没有办法如何做到这一点。因为我是全新asax文件概念的新手感谢

I want to get all login user list at welcome user page .So each user can see the login user list.For that I have created a session ["username"] in login page and after that i want to use that sesion in session start method of asax and i want to retrieve all the login users and store it into application scope and i also want to remove and insert users on login and logout page.so i am not getting a way how would i do that .because i am new to the concept called global asax file thanks

推荐答案

您可以通过保存到数据文件或更新数据库中的用户表来跟踪谁登录有一列用作标志。然后使用诸如从登录名为1的用户中选择名称之类的查询。
You could track who's logged in by saving into a data file or updating a User table in a database which has a column used as a flag. Then use a query such as 'select Names from Users where Login=1'.


可能有更好的方法,但如果没有别的,你应该能够在global.asax中保存它,一个单身人士班。只需使用用户名创建一个字符串列表,然后将用户附加到列表中,并使用列表计数作为您的总用户数。但我怀疑有这样的标准方法来做这样的事情。但如果你找不到一个好的解决方案,你可以很容易地自己构建它。
There may be better ways, but if nothing else you should be able to hold this in a global.asax, a singleton class. Just create a string list with the user name, then append the users to your list and use the lists count for your total number of users. But I suspect there are standard approaches to doing such as thing as this. But if you cannot find a good solution, you could build it out yourself pretty easily.


这篇关于如何在应用程序范围内获取所有登录用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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