Custom HttpModule for IIS 7 for integrated

荒凉一梦 提交于 2019-12-03 13:10:12

From what I can see you're on the right track. Have you made sure your site's application pool is set to Managed Pipeline mode?

Also if you're testing this with the built in Visual Studio web server (Cassini) then the <system.webServer> section will be ignored. You'll need IIS7 or IIS7.5 Express if you want the module to load from there.

I had this problem and discovered that not turning off customErrors prevented the handler from triggering.

ie: this is required in your config for the Error event to be captured in the HttpModule:

<system.web>
    <customErrors mode="Off" />
</system.web>
erules

I was experiencing the same problem of a handler that is not getting triggered, by doing following change to the above code helped me to resolve this issue. Instead of creating a new event handler I just attached the method with same signature to that event.

application.Error += ErrorHandler;

This works for me, still analyzing what is the reason behind this way attaching a handler works in IIS7.

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