Re: implementing users' counting with global.asax



that is a glich in your code, because Session.OnStart only fires when a New
Session is required from the user, or everytime that timesout and need to
set a new one

Application_Onstart you need to stop and start the server so that can be
fired

if you do not own the server, just add to the Session_OnStart

if isNumeric(application("howmany")) then
application("howmany") += 1
else
application("howmany") = 0
end if
--

Bruno Alexandre
(a Portuguese in Københanv, Danmark)


"R.A.M." <r_ahimsa_m@xxxxxxxxxxxxxx> escreveu na mensagem
news:oicv82hvij935innbgp9r94kapdivmvbhh@xxxxxxxxxx
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/


.



Relevant Pages


Loading