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
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."