How do I stop IIS7 from putting out its own 404 before my MVC app gets a chance to handle it?

后端 未结 5 1618
情书的邮戳
情书的邮戳 2021-01-01 23:19

I have an ASP.NET MVC 2 application, which has an Application_Error event handler in global.asax. In this, I\'m detecting the case where the Exception type is HttpException

5条回答
  •  臣服心动
    2021-01-01 23:56

    In ASP.NET MVC I use a custom ErrorController with an Index method (default handler) and a few custom handlers (401, 404) using the following web.config settings

    
    
        
        
    
    

    I don't use Application_Error except for logging purposes.

提交回复
热议问题