asked on
ASKER
public class Global : System.Web.HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
// Set our user count to 0 when we start the server
Application["HitCounter"] = 0;
}
protected void Session_Start(object sender, EventArgs e)
{
Application.Lock();
Application["HitCounter"] = (int)(Application["HitCounter"]) + 1;
Application.UnLock();
}
protected void Session_End(object sender, EventArgs e)
{
Application.Lock();
Application["HitCounter"] = (int)(Application["HitCounter"]) - 1;
Application.UnLock();
}
protected void Application_End(object sender, EventArgs e)
{
}
}
ASKER
The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.
TRUSTED BY
You can do so with following,
Add a counter in Application and just randomly chose one user. // but there is a disadvantage of it, if your application restarts then it will restart the counter. you can avoid then by saving this counter with date in some file on the server.
Thanks