mephisto’blog

二人行,也有吾师!
Fork me on GitHub

计算在线人数

 

Global中

protected void Application_Start(Object sender, EventArgs e)
{
Application["Counter"] = "0";
}
protected void Session_Start(Object sender, EventArgs e)
{
 Application.lock();
 Application["Counter"] = Convert.ToInt32(Application["Counter"])+1;
 Application.unlock();
}
protected void Session_End(Object sender, EventArgs e)
{
 Application.lock();
 Application["Counter"] = Convert.ToInt32(Application["Counter"])-1;
 Application.unlock();
}

 

posted @ 2007-05-28 14:48  sinodzh  阅读(234)  评论(0)    收藏  举报