HttpModule with ASP.NET MVC not being called

流过昼夜 提交于 2019-12-01 03:27:14

Turns out there's a Web.config file in the Views folder, and one in the root. Guess which one I registered the httpModules in? Yep, the Views folder one. I moved it to the root Web.config and now it works like a charm.

You might have to put the Response.Write in the method that subscribes to the EndRequest (or the BeginRequest) event. I'm guessing the Response object hasn't been fully initialized at the Init stage.

My problem was that I had [HandleError] on the Controller Method, which was catching the error before my custom error handler had a chance to.

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