如何获取iis 6中的活动用户列表

时间:2010-02-27 22:16:14

标签: asp.net iis-6

如何在IIS 6中检索活动用户列表(带有帐户ID)。

2 个答案:

答案 0 :(得分:1)

假设您的网站是活跃的访客而不是活跃的用户,而且我发现您使用的是asp.net ...您可以尝试下面的代码。

Global.asax中

 Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
'Set the initial CurrentNumberOfUsers count to zero
Application("CurrentNumberOfUsers") = 0
 End Sub

 Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
' Add the newest user to the CurrentNumberOfUsers count
Application("CurrentNumberOfUsers") += 1
 End Sub

 Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
' Remove the last user from the CurrentNumberOfUsers count
Application("CurrentNumberOfUsers") -= 1
 End Sub

然后要在页面中检索它,您将使用类似

的内容
label1.text = Application("CurrentNumberOfUsers")

现在,如果你想获得注册用户的数量,你可以试试这样的事情。

Membership.GetNumberOfUsersOnline()

如果您需要网站上的用户总数,可以使用

Membership.GetAllUsers.Count()

至于“With Account ID”部分... mmmm,不确定......必须遍历每个活动帐户并提取它的ID。

答案 1 :(得分:0)

II6不存储用户帐户,因此不会公开任何返回用户帐户的功能。