您的位置:首页 > 理论基础 > 计算机网络

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

2015-07-11 01:43 567 查看
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");
}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: