In global.asaxfollow these steps:
Handle the event Application.Startby adding the following:
Application["LiveSessionsCount"] = 0;
Handle the event Session.Startby adding the following:
Application["LiveSessionsCount"] = ((int) Application["LiveSessionsCount"]) + 1;
Handle the event Session.Endby adding the following:
Application["LiveSessionsCount"] = ((int) Application["LiveSessionsCount"]) - 1;
To get the number of sessions on your page, write the following:
int LiveSessionsCount = (int) Application["LiveSessionsCount"];
source
share