application用法

void Application_Start(object sender, EventArgs e)
{
Application.Lock();
Application["count"] = 0;
Application.UnLock();
}

void Session_Start(object sender, EventArgs e)
{
int count = Convert.ToInt32(Application["count"]);
count++;
Application["count"] = count;

}

void Session_End(object sender, EventArgs e) 
{
    // 在会话结束时运行的代码。 
    // 注意: 只有在 Web.config 文件中的 sessionstate 模式设置为
    // InProc 时,才会引发 Session_End 事件。如果会话模式设置为 StateServer
    // 或 SQLServer,则不引发该事件。
    int count = Convert.ToInt32(Application["count"]);
    count--;
    Application["count"] = count;
}

posted on   木屐  阅读(186)  评论(0编辑  收藏  举报

< 2025年2月 >
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 1
2 3 4 5 6 7 8

导航

统计

点击右上角即可分享
微信分享提示