如何查找没有用户登录名 [英] How to Find No Of User Login

查看:72
本文介绍了如何查找没有用户登录名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好
我有一个Web应用程序,并且那里有用户数量,在登录时,我将用户名放入会话中.所以我的问题是我想获取所有已登录应用程序的用户名.


谢谢.

Hello
I have an Web Application and number of users are there, at the time of login I am putting the name of user in session. So my problem is that i want to fetch all the user name who has login the application.


Thanks in Adv.

推荐答案



您可以将会话信息存储在数据库中.存储后,您可以获得登录的用户数.但是问题将出在会话过期上.如果您关闭会话,则会话不会过期.如果您关闭浏览器,则用户将看起来像在线.

检查本文:在SQL Server中存储会话 [
Hi,

You can store your session information in database. After storing you can get the number of users that are login. But the problem will be with session expiration. if your session will not expire if you close your brower user will be look like online.

Check this article : Store Session in SQL Server[^]

Other way is you can set a flag in userMaster table and once user logout you can reset it. this way you can also get the online user. But again in this scenario you have such issue with closing/browser crash.




本文可能会对您有所帮助.
如何显示在线数ASP.NET网站的用户访问者 [此线程 [
Hi,

this article may help you.
How to show number of online users visitors for ASP.NET website[^]

[UPDATED]

To get all user names
check this Thread[^]




这篇Articale可能会帮助您,

进入一个具有这样的事件的Globle.asax页面;

Hi,

This Articale May be Help You ,

Take One Globle.asax page this having events Like This;

void Application_Start(object sender, EventArgs e)
        {
            Application["Toatal"] = 0;
            Application["Online"] = 0;
            Session.Timeout = 60;

        }

        void Application_End(object sender, EventArgs e)
        {
            //  Code that runs on application shutdown

        }

        void Application_Error(object sender, EventArgs e)
        {
            // Code that runs when an unhandled error occurs

        }

        void Session_Start(object sender, EventArgs e)
        {
            Application["Toatal"] = Convert.ToInt32(Application["Toatal"]) + 1;
            Application["Online"] = Convert.ToInt32(Application["Online"]) + 1;

        }

        void Session_End(object sender, EventArgs e)
        {
            Application["Online"] = Convert.ToInt32(Application["Online"]) - 1;

        }




接受另一个Aspx页面,其中包含两个标签

并分配这两个值




Take another Aspx page In that take two lables

and assign this two vales

Application["Toatal"] and
            Application["Online"]



您可以获得访客和在线访客的总数...



you can get total number of visiters and online visiters...


这篇关于如何查找没有用户登录名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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