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 startedApplication("UserCount") = Application("UserCount") + 1 End SubSub Session_End(ByVal sender As Object, ByVal e As EventArgs) ' Fires when the session endsApplication("UserCount") = Application("UserCount") - 1 End SubTo Display UserCount, add a Label Control to the We |
|
| bForm, 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 | |
