How开发者_开发问答 do I retrieve list of Active users (with account ids) in IIS 6.
Providing that you mean active VISITORS on your site rather than active USERS, and the fact that I see that you're using asp.net... you could try the code below.
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
and then to retrieve that in your page, you would use something like
label1.text = Application("CurrentNumberOfUsers")
Now if you are trying to get the number of registerd users, you could try something like this.
Membership.GetNumberOfUsersOnline()
And if you need the total number of users on your site, you can use
Membership.GetAllUsers.Count()
As for the "With Account ID's" part... mmmm, not sure... prolly have to loop through each active account and pull it's ID.
II6 doesn't store user accounts and therefore doesn't expose any functionality to return user accounts.
精彩评论