CodeWidgets.com: Online Source Code Library: C#, ASP, ASP.NET, VB, VB.NET, VB Script, Microsoft Access, Excel, JavaScript, J Script, XML, VBScript, Website Design, DevExpress Components, Reporting, Application and Website Templates.

Widget #CS0124

Display the number of Active Users on your website (ASP.NET)

Free

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

Last Updated: 10/9/2019


Related Widgets 
Price 
# 
CS0040 Add Sounds to button events. ASP.NET$0.00Add To Cart

Recently Viewed Widgets 
Price 
# 
No data to display

Collapse/Expand
Format

Download

Online Purchase And Pickup


Collapse/Expand
License

License

PromoWare

Single Developer Licence.
Re-Distribution Permitted only as part of a compiled Application.This source code is provided to you "as is" without warranty.
CLICK HERE FOR TERMS OF USE
Copyright 2000-2018 CodeWidgets.com and Comrie Software Solutions


This website uses Cookies to store User information and Shopping Cart Items for the duration of your visit to CodeWidgets.com.

No Credit Card or Financial information is stored by CodeWidgets.com. Click Here For Our Complete Privacy Policy and Terms of Use.

I Understand