title: Error handling for ASP.NET MVC 2 and IIS 7.0
body: <p>Good day!</p>
  
  <p>I've recently switched from IIS 6.0 to IIS 7.x and I'm in search of error handling technique of my dream for ASP.NET MVC 2.</p>
  
  <p>What I want to achive:</p>
  
  <ul>
  <li><p>Handle all unhandled exceptions in one place (preferable in Global.asax handler)</p></li>
  <li><p>Custom handlers for 404 and 403 errors (both for MVC controller\actions and static files). These handlers should not perform rewriting and should send HTTP error codes. 
  For example if user navigates to <a href="http://example.com/non-existing-page/" rel="nofollow noreferrer">http://example.com/non-existing-page/</a> he should remain on this URL, but get HTTP 404 status and custom 404 page.</p></li>
  <li><p>Ability to trigger 404 and 403 errors programmatically from actions. For example if user specified non-existing page number in paging, like this: <a href="http://example.com/posts/page-99999/" rel="nofollow noreferrer">http://example.com/posts/page-99999/</a></p></li>
  <li><p>It will be great if this error handling will work the same for VS Development Server (I know about IIS Express, but for now I should stick to VS Dev Server)</p></li>
  </ul>
  
  <p>I've used this: <a href="http://blogs.microsoft.co.il/blogs/shay/archive/2009/03/06/real-world-error-hadnling-in-asp-net-mvc-rc2.aspx" rel="nofollow noreferrer">http://blogs.microsoft.co.il/blogs/shay/archive/2009/03/06/real-world-error-hadnling-in-asp-net-mvc-rc2.aspx</a>
  while being on IIS 6.0, but now on IIS 7.0 with integrated pipeline I see IIS error messages instead of my handlers.</p>
  
  <p>Thanks in advance!</p>