主要是继承IHttpModule和IHttpHandler来重写其 中的方法,IhttpModule 中重写其Init方法及各种请示过程事件和Dispose方法
























































然后生成dll,新建个asp.net应用,引用此dll,在web.config中加入
<httpModules>
<add name="test" type="CustomerHttpModules.MyHttpModules,CustomerHttpModules"/>
</httpModules>
则当有页面请求时会查找到此dll,然后执行其中过程。
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
以下为重写IHttpHandler中方法的代码:
同样地建个类库


















































所有页面请示的核心处理都是通过IHttpHandler的ProcessRequest方法来完成,因此只要我们重写此方法,则无论页面有任何请求,都会被我们所重写的内容代替掉。嘿嘿
生成dll后再在asp.net应用中的 web.config 中加入
<httpHandlers>
<add verb="*" path="*" type="CustomerHttpModules.MyHttpModules,CustomerHttpModules"/>
</httpHandlers>
看看效果吧