最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Application 简介绍与计数器实例
时间:2022-06-25 05:34:33 编辑:袖梨 来源:一聚教程网
application 简介绍与计数器实例
event-handling方法描述
application_start()发生当应用程序的开始
这是他第一次收到任何用户的要求。
application_end()发生当应用程序正在关闭的时候,通常而言,是因为网络服务器正在重新启动。
application_beginrequest()中,发生在每个请求的应用得到的,就在这个页面代码被执行。
application_endrequest()
简单存值实例
sub click(obj as object, e as eventargs)
session.abandon()
end sub
利用application 做简单计数器
"">
http://www.w***3.org/1999/xhtml" >
锁定application
http://www.*w**3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
http://www.w***3.org/1999/xhtml" >
file: default.aspx.cs
using system;
using system.data;
using system.configuration;
using system.web;
using system.web.security;
using system.web.ui;
using system.web.ui.webcontrols;
using system.web.ui.webcontrols.webparts;
using system.web.ui.htmlcontrols;
public partial class _default : system.web.ui.page
{
protected void page_load(object sender, eventargs e)
{
if (application["pagecounter"] != null &&
(int)application["pagecounter"] >= 10)
{
application.remove("pagecounter");
}
if (application["pagecounter"] == null)
{
application["pagecounter"] = 1;
}
else
{
application.lock();
application["pagecounter"] =
(int)application["pagecounter"] + 1;
application.unlock();
}
mylabel.text = convert.tostring(application["pagecounter"]);
}
}
相关文章
- 荒原曙光日升之冕有哪些功能 11-05
- 发朋友圈的句子 11-05
- 三国天下归心吕布有什么天赋及技能 11-05
- 二重螺旋风系阵容怎么搭配 11-05
- 神迹觉醒太阳神有哪些技能 11-05
- 三国望神州韩遂有什么玩法技巧 11-05