Please help.
I try to implement counting of apllication users using global.asax
this way:
<script runat="server">
void Application_OnStart(object sender, EventArgs e)
{
Application.Add("Użytkownicy", 0);
}
void Application_OnEnd(object sender, EventArgs e)
{
Application.Remove("Użytkownicy");
}
void Session_OnStart(object sender, EventArgs e)
{
Application.Lock();
Application["Użytkownicy"] =
Convert.ToInt32(Application["Użytkownicy"]) + 1;
Application.UnLock();
}
void Session_OnEnd(object sender, EventArgs e)
{
Application.Lock();
Application["Użytkownicy"] =
Convert.ToInt32(Application["Użytkownicy"]) - 1;
Application.UnLock();
}
</script>
Unfortunatelly it does not work because Session OnStart/OnEnd and even
Application OnStart/OnEnd are called more often than I thought. For
Session_OnEnd/Session_OnStart instance it's sometimes called when
another page is selected from sitemap menu.
Do you know how to programme it?
Thank you very much.
/RAM/