我创建的IHttpModule实现
public class ResponseTweaker : IHttpModule { // my module ...在Web.config中注册
<system.web>
<httpModules>
<add name="redman" type="ResponseTweaker"/>
</httpModules>它的一个例子就在管道里。
从调用者的角度(例如从Global.asax.cs文件),应如何获得?
发布于 2010-11-07 01:08:27
这些模块可以在HttpContext.Current.ApplicationInstance.Modules中找到。
您可以查看HttpModuleCollection,也可以使用名称语法:HttpContext.Current.ApplicationInstance.Modules["redman"]。您可能需要将返回的IHttpModule转换为ResponseTweaker。
如果类型可能不同,则搜索集合以查找与所需类型匹配的模块。
https://stackoverflow.com/questions/4115955
复制相似问题