the number of visitor will increase by click, but every time when i close my browser, the number of visitor never decreased
my testing step
1)click f5 on my browser, number of visitor increased by 1
2)open another browser ,number of visitor increased again, current number of visitor is 2
3)open 1 more browser, total number of visitor now is 3
4)closed 1 broweser, by right the number of visitor should decreased by 1
5)i clicked refresh on opened browser
6)the existed browser should total number of visitor =3
7)total number of visitor never decreased =(
private static int member = 0;
private static int visitor = 0;
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
Application["Member"] = member;
Application["Visitor"]=visitor;
}
void Session_Start(object sender, EventArgs e)
{
// Code that runs when a new session is started
visitor += 1;
Application.Lock();
Application["Visitor"] = visitor;
Application.UnLock();
}
void Session_End(object sender, EventArgs e)
{
// Code that runs when a session ends.
// Note: The Session_End event is raised only when the sessionstate mode
// is set to InProc in the Web.config file. If session mode is set to StateServer
// or SQLServer, the event is not raised.
visitor -= 1;
Application.Lock();
Application["Visitor"] = visitor;
Application.UnLock();
}