【http】生命周期和http管道技术 整理中

 httpModules 与 httpHandlers  正在写demo

 

public class Httpext : IHttpModule
{
public void Dispose()
{
throw new NotImplementedException();
}

public void Init(HttpApplication context)
{
context.BeginRequest += new EventHandler(this.BeginRequest);
}
private void BeginRequest(object r_objSender, EventArgs r_objEventArgs)
{
HttpApplication objApp = (HttpApplication)r_objSender;
objApp.Response.Write("您请求的URL为" + objApp.Request.Path);
}
}

 

<system.webServer>
<modules>
<add name="MyModule" type="httppip.Httpext, httppip, Version=1.0.0.0, Culture=neutral" />
</modules>

</system.webServer>

 

public partial class About : Page
{
protected void Page_Load(object sender, EventArgs e)
{

}

public override void ProcessRequest(HttpContext context)
{
context.Response.Write("我是HttpHandler");
}


}

 

你可能感兴趣的:(http)