ASP.NET Response.Filter does not call Write

时光怂恿深爱的人放手 提交于 2020-01-03 01:52:21

问题


I have an ASP.NET http module that adds a Response Filter and does some changes to the outgoing HTML based on a regular expression. The other day I noticed it doesn't seem to be working correctly anymore. Upon inspection I noticed that the Write method never gets called.

I believe this started happening after we moved over to .NET 4.0 / IIS 7.5 (from 3.5 / IIS 6) and we now use Integrated mode.

The response filter gets added in the BeginRequest event of the IHttpModule...

context.Response.Filter = new FormActionFilter(context.Response.Filter);

I did see that the Response Filter's Flush and Close methods get called but my breakpoints in Write were never hit.

Anyone else experience this issue or have any insights on why this happens?


回答1:


The http module section in the web.config has changed in iis 7 from iis6. It should be under System.WebServer instead of system.Web -> httpModules. Have you already made this change?

 <system.webServer>
       <modules>
             <add name="YourModuleName" type="YourNamespace.YourModuleClassName,YourAssemblyName"/>
    </modules>


来源:https://stackoverflow.com/questions/6737487/asp-net-response-filter-does-not-call-write

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!