最新下载
热门教程
- 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()
简单存值实例
<%@ page language="vb" %>
利用application 做简单计数器
<%@ page language="c#" %>
"http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
http://www.w3.org/1999/xhtml" >
锁定application
<%@ page language="c#" autoeventwireup="true" codefile="default.aspx.cs" inherits="_default" %>
http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
http://www.w3.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"]);
}
}
相关文章
- 《弓箭传说2》新手玩法介绍 01-16
- 《地下城与勇士:起源》断桥烟雨多买多送活动内容一览 01-16
- 《差不多高手》醉拳龙技能特点分享 01-16
- 《鬼谷八荒》毕方尾羽解除限制道具推荐 01-16
- 《地下城与勇士:起源》阿拉德首次迎新春活动内容一览 01-16
- 《差不多高手》情圣技能特点分享 01-16