如何在asp.net中查看在线用户? [英] how to view online users in asp.net?

查看:75
本文介绍了如何在asp.net中查看在线用户?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何向我的asp.net应用程序显示在线用户?我正在使用SQL表存储用户名和密码。请帮助我。

解决方案

参考 -



1. 如果用户在线,如何检入ASP.NET? [ ^ ]

Quote:

ASP.NET Membership服务支持此功能。要获取特定用户的上次活动日期,请使用 LastActivityDate 属性并指示用户是否在线使用 IsOnline 属性。另外,为了获得在线用户的数量,请使用 GetNumberOfOnlineUsers 。当然,ASP.NET Membership服务不保存最后的IP地址,在这种情况下你必须覆盖 SqlMembershipProvider 的某些行为。

2。 在ASP.Net网站上显示在线用户/访问者 [ ^ ]


首先检查类似的CP线程:

如何查看谁在线asp.net网站c# [ ^ ]



那么我应该说,如果你使用会员资格 [ ^ ]然后简单致电 Membership.GetNumberOfUsersOnline [ ^ ]。



另请查看:

获取ASP.NET中的在线用户 [ ^ ]


显示您网站当前活动的用户/会话数。

使用Session_Start和Session_End事件



  Sub  Session_Start( ByVal 发​​件人作为 对象 ByVal  e  As  EventArgs)
' 会话启动时触发
应用程序( UserCount)=应用程序( UserCount)+ 1
结束 Sub

Sub Session_End( ByVal sender As Object ByVal e As EventArgs)
' 会话结束时触发
应用程序( UserCount)=应用程序( UserCount) - 1
结束 Sub
显示UserCount,添加标签控件 WebForm,将其命名为lblUserCount

私有 Sub Page_Load ( ByVal sender As System。 Object ByVal e As System.EventArgs)句柄 MyBase .Load
' 将用户代码放入在此初始化页面
.lblUserCount.Text = 用户在线&应用程序( UserCount
结束 Sub


how to show online users my asp.net application? i'm using SQL table to store username and passwords.please help me.

解决方案

Refer -

1. How to check in ASP.NET if the user is online?[^]

Quote:

The ASP.NET Membership service supports this feature. To get the particular user's last activity date, use LastActivityDate property and to indicate whether the user is online or not use IsOnline property. Also to get the number of online users, use GetNumberOfOnlineUsers. Of course, the ASP.NET Membership service does not save the last IP address, and you have to override some behavior of SqlMembershipProvider in this case.

2. Show Online Users/Visitors in ASP.Net website[^]


Check similar CP thread first:
How to see who is online in asp.net website c#[^]

Then i should say, if you use Membership[^] then simply call Membership.GetNumberOfUsersOnline[^].

Also view:
Get online users in ASP.NET[^]


Display the number of users/sessions currently active your website.
Using the Session_Start and Session_End Events

Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session is started
Application("UserCount") = Application("UserCount") + 1
End Sub

Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session ends 
Application("UserCount") = Application("UserCount") - 1
End Sub
To Display UserCount, add a Label Control to the WebForm, name it lblUserCount

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Me.lblUserCount.Text = "User(s) online " & Application("UserCount")
End Sub


这篇关于如何在asp.net中查看在线用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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