页面记数器
来源:互联网 发布:windows批处理命令教程 编辑:程序博客网 时间:2024/06/04 08:37
login.aspx
<%@ Page language="c#" Codebehind="Login.aspx.cs" AutoEventWireup="false" Inherits="ASPNETPage.Login" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:Label id="lbInfo" style="Z-INDEX: 101; LEFT: 216px; POSITION: absolute; TOP: 111px" runat="server" Width="256px"></asp:Label>
</form>
</body>
</HTML>
login.aspx.cs
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace ASPNETPage
{
/// <summary>
/// WebForm1 的摘要说明。
/// </summary>
public class Login : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label lbInfo;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
lbInfo.Text = "您是第" + Application["Counter"] + "位访问者";
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}
global文件
using System;
using System.Collections;
using System.ComponentModel;
using System.Web;
using System.Web.SessionState;
using System.IO;
namespace ASPNETPage
{
/// <summary>
/// Global 的摘要说明。
/// </summary>
public class Global : System.Web.HttpApplication
{
public Global()
{
InitializeComponent();
}
protected void Application_Start(Object sender, EventArgs e)
{
// StreamReader rd = new StreamReader(Server.MapPath("counter.txt"));
// int nNum = int.Parse(rd.ReadLine());
// Application.Lock();
// Application["Counter"] = nNum;
// Application.UnLock();
// rd.Close();
}
protected void Session_Start(Object sender, EventArgs e)
{
// Application.Lock();
// Application["Counter"] = Convert.ToInt32(Application["Counter"])+1;
// Application.UnLock();
// //写入
// StreamWriter sw = new StreamWriter(Server.MapPath("counter.txt"),false);//false为不追加
// sw.WriteLine(Application["Counter"]);
// sw.Close();
}
protected void Application_BeginRequest(Object sender, EventArgs e)
{
}
protected void Application_EndRequest(Object sender, EventArgs e)
{
}
protected void Application_AuthenticateRequest(Object sender, EventArgs e)
{
}
protected void Application_Error(Object sender, EventArgs e)
{
}
protected void Session_End(Object sender, EventArgs e)
{
}
protected void Application_End(Object sender, EventArgs e)
{
// //写入
// StreamWriter sw = new StreamWriter(Server.MapPath("counter.txt"),false);//false为不追加
// sw.WriteLine(Application["Counter"]);
// sw.Close();
}
#region Web Form Designer generated code
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
}
#endregion
}
}
- 页面记数器
- jsp防刷新记数器
- jsp防刷新记数器
- PHP实现的记数器
- csdn记数器停止了
- for循环记数器
- asp.net文本记数器(C#)
- Asp.Net中的记数器[初级]
- Asp.Net中的记数器[初级]
- asp.net文本记数器(C#)
- 在网页中访问量添加记数器
- asp.net图型记数器(C#)
- asp.net防刷新记数器问题
- 如何在网页中加入访问记数器
- 最简单的PHP程序--记数器
- PHP下定制自己的记数器
- 关于用JSP写的记数器的问题
- 用PHP来写记数器(详细介绍)
- 八卦文章《胡子决定编程语言运势(<程序员2005年第一期文章)》
- 关于奢侈这件事
- 朋友推的歌:2006年最伤感歌曲之一 [全记录] <戒烟容易戒你太难>
- 又是一个情人节
- 讨论:Java内存泄露问题
- 页面记数器
- Http状态码
- Spring AOP实际应用一例
- 《PHPMORE》Vol6,web2.0专刊发布了.
- 接下来。。。
- 看到魔戒的花絮
- JSP/Servlet 中的汉字编码问题
- 七宗罪
- (转贴)一位网友评《一个馒头引起的血案》