Rules

Secret ingredients to quality software

Edit
Info

Do you present the user with a nice error screen? (Web Only)

Last updated by Tiago Araújo [SSW] on 16 Mar 2021 10:28 pm (about 2 months ago) See History

Your users should never see the “yellow screen of death” in ASP.NET. Errors should be caught, logged and a user-friendly screen displayed to the user.

This last part is done by specifying the customErrors element in the web.config file.

This will activate ASP.NET’s built in error page (e.g. MVC’s HandleErrorAttribute filter) which can then be customized to suit your application.

error screen bad
Figure: Bad Example – Yellow Screen of Death

error screen good
Figure: Good Example - Default ASP.NET MVC custom error page

However, as a developer you still want to be able to view the detail of the exception in your local development environment. Use the below setting in your Web Application's web.config file to view the yellow screen locally but present a nice error screen to the user.

14 08 2014 2 47 50 PM compressor
Figure: Good Example - Don't hide the yellow screen of death in the local environment

Adam CoganAdam Cogan
Drew RobsonDrew Robson

We open source. This page is on GitHub