Simple two steps:
1.Add this code in Global.asax
1.Add this code in Global.asax
void Application_Start(Object Sender, EventArgs E)
{
Application["CurrentUsers"] = 0;
}
void Session_OnStart(object Sender, EventArgs E)
{
Application.Lock();
Application["CurrentUsers"] = System.Convert.ToInt32(Application["CurrentUsers"]) + 1;
Application.UnLock();
}
void Session_OnEnd(object Sender, EventArgs E)
{
Application.Lock();
Application["CurrentUsers"] = System.Convert.ToInt32(Application["CurrentUsers"]) - 1;
Application.UnLock();
}
2.In Aspx Page
<%=Application["CurrentUsers"].ToString()%>
In web.config timeout will be make 10, by default 20