<%@ Application Language="C#" %> <script runat="server"> public static int totalNumberOfUsers = 0; public static int currentNumberOfUsers = 0; void Application_Start(object sender, EventArgs e) { // Code that runs on application startup Application["totalNumberOfUsers"] = 0; Application["currentNumberOfUsers"] = 0; } void Session_Start(object sender, EventArgs e) { // Code that runs when a new session is started Application.Lock(); Application["totalNumberOfUsers"] = ((int)Application["totalNumberOfUsers"] + 1); Application["currentNumberOfUsers"] = ((int)Application["currentNumberOfUsers"] + 1); Application.UnLock(); } void Session_End(object sender, EventArgs e) { Application.Lock(); Application["currentNumberOfUsers"] = ((int)Application["currentNumberOfUsers"] - 1); Application.UnLock(); } </script>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)