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

后端 未结 5 1582
情书的邮戳
情书的邮戳 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:45

    I answered that in another post: ASP.NET Application hosted on IIS7 that is ignoring custom errors and falls back to IIS errors

    "To disable the IIS error messages you have to set

      Response.TrySkipIisCustomErrors = true;
    

    in your error page. After that, your Error messages should show without problem."

提交回复
热议问题