Count online person rely ip address and update online person automatic ??
Hello Friend!
My question is i can count online person by rely the ip address of client ??
My code is i have 1 page .aspx to display online person and the global.asax to increase or reduce online person.This is code in .aspx:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Response.Write("Person online is:");
Response.Write(Application["person_online"].ToString());
}
}
And this is .asax
protected void Application_Start(object sender, EventArgs e)
{
Application["person_online"] = 0;
}
protected void Session_Start(object sender, EventArgs e)
{
Application.Lock();
Application["person_online"] = Convert.ToInt32(Application["person_online"]) + 1;
//Session.Timeout = 1;
Application.UnLock();
}
protected void Session_End(object sender, EventArgs e)
{
Application.Lock();
Application["person_online"] =Convert.ToInt32(Application["person_online"])-1;
Application.UnLock();
}
So when i run my page by 3 browser(firefox,internet-explorer,chrome) -> it displayed 3 person online when i reload page but i think it exactly is 1 not 3. Someone give me the way to process it's good??
And the next problem is Can i update the person online automatic .I mean when i turn off 1 browser that one of 3 browser ->so the person online automatic reduce 1 needn't press F5 or reload page on other browser(other client)??Someone help me.Thanks