Help the documentation team understand which areas of ASP.NET and Tooling need better help topics

Best practices for error handling within MVC (that correctly account for all scenarios)

Correct error handling is more complicated than just working with HandleErrorAttribute or <customErrors>. Good error handling should account for a variety of scenarios:
* 404 errors that preserve the path and return the correct error code
* 500 status codes for uncaught exceptions
* Dealing with errors that operate outside of the context of a controller (which may not be matched)
* Pages that result in errors likely shouldn't be cached, especially if the error is transient
* Accounting for the possibility of unsafe paths in the request
* Logging errors so that they're not lost
* Rendering error pages that preserve a site's layout

There is competing (and misleading?) information out there, both within ASP.NET documentation and provided by users. Any direction would be greatly appreciated!

100 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Tim Mackenzie shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    1 comment

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)
      Submitting...
      • Vince commented  ·   ·  Flag as inappropriate

        In addition, I’d like to see how to handle exceptions triggered by AJAX calls.
        How to globally handle 400, 401, 403, 404, 500 and perhaps show a bootstrap modal for example.

      Feedback and Knowledge Base