时间:2016-02-15 22:03 来源: 我爱IT技术网 作者:佚名
欢迎您访问我爱IT技术网,今天小编为你分享的编程技术是:【验证一个ASP.NET应用程序和页面的生命周期的实现代码】,下面是详细的讲解!
验证一个ASP.NET应用程序和页面的生命周期的实现代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
public class TestClass : IHttpModule
{
HttpApplication httpApp;
public static List<string> EventList=new List<string>();
public TestClass()
{
}
public void Dispose()
{ }
public void Init(HttpApplication context)
{
this.httpApp=context;
//EventList.Clear();
EventList.Add("Initiated");
context.BeginRequest +=new EventHandler(context_BeginRequest);
context.AuthenticateRequest +=new EventHandler(context_AuthenticateRequest);
context.AuthorizeRequest +=new EventHandler(context_AuthorizeRequest);
context.ResolveRequestCache +=new EventHandler(context_ResolveRequestCache);
context.AcquireRequestState +=new EventHandler(context_AcquireRequestState);
context.PreRequestHandlerExecute +=new EventHandler(context_PreRequestHandlerExecute);
context.PostReleaseRequestState +=new EventHandler(context_PostReleaseRequestState);
context.ReleaseRequestState +=new EventHandler(context_ReleaseRequestState);
context.UpdateRequestCache +=new EventHandler(context_UpdateRequestCache);
context.EndRequest +=new EventHandler(context_EndRequest);
}
private void context_EndRequest(object sender, EventArgs e)
{
EventList.Add("HTTP Modules: End Request <hr>");
foreach (string str in EventList)
{
httpApp.Response.Write(str + "<br>");
}
EventList.Clear();
}
void context_UpdateRequestCache(object sender, EventArgs e)
{
EventList.Add("HTTP Modules: Update Request Cache");
}
void context_ReleaseRequestState(object sender, EventArgs e)
{
EventList.Add("HTTP Modules: Release Request State");
}
void context_PostReleaseRequestState(object sender, EventArgs e)
{
EventList.Add("HTTP Modules: Post Release Request State");
}
void context_PreRequestHandlerExecute(object sender, EventArgs e)
{
EventList.Add("HTTP Modules: Pre Request Handler Execution");
}
void context_AcquireRequestState(object sender, EventArgs e)
{
EventList.Add("HTTP Modules: Acquire Request State");
}
void context_ResolveRequestCache(object sender, EventArgs e)
{
EventList.Add("HTTP Modules: Resolve Request");
}
void context_AuthorizeRequest(object sender, EventArgs e)
{
EventList.Add("HTTP Modules: Authorize Request");
}
void context_AuthenticateRequest(object sender, EventArgs e)
{
EventList.Add("HTTP Modules: AuthenticateRequest");
}
void context_BeginRequest(object sender, EventArgs e)
{
EventList.Add("HTTP Modules: Begin Request");
}
}
关于验证一个ASP.NET应用程序和页面的生命周期的实现代码的用户互动如下:
相关问题:
答: >>详细
相关问题:
答: >>详细
相关问题:
答: >>详细
- 【asp】asp.net url重写浅谈-net-url重写
- 【DataSet】DataSet、DataTable、DataRow区别详解
- 【创建】ASP.NET Web API教程 创建域模型的方法详
- 【asp】asp.net ubb使用代码-net-ubb使用
- 【页面打印】关于ASP.NET页面打印技术的常用方法
- 【MVC5】MVC 5 第一章 创建MVC 5 web应用程序-net
- 【服务器】asp.net页面状态管理cookie和服务器状
- 【asp】asp.net更新指定记录的方法-net--更新-指
- 如何取消.net后台线程的执行
- 【回发】ASP.NET 回发密码框清空问题处理方法-密
- 评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)
-
