62,267
社区成员
发帖
与我相关
我的任务
分享global.asax.cs文件
protected void Application_Start(Object sender, EventArgs e)
{
Application["counter"] = 0;
}
protected void Session_Start(Object sender, EventArgs e)
{
Application.Lock();
Application["counter"] = (int)Application["counter"] + 1;
Application.UnLock();
}
protected void Session_End(Object sender, EventArgs e)
{
Application.Lock();
Application["counter"] = (int)Application["counter"] - 1;
Application.UnLock();
}
cout.aspx.cs文件:
private void Page_Load(object sender, System.EventArgs e)
{
counter.Text = "当前页面有:<b>" + Application["counter"].ToString() + "" + "</b> 位访问者 !";
}