Note: This article was originally published in 2009. Some steps, commands, or software versions may have changed. Check the current .Net documentation for the latest information.

Prerequisites

Before you begin, make sure you have:

  • Visual Studio or .NET CLI installed
  • .NET Framework or .NET Core SDK
  • Basic C# programming knowledge

How can you create custom error pages on an ASP.Net application so that you can better control the user experience when the unexpected happens? A: There is a configuration parameter in the Web.Config you can use to control what error pages the user sees:

This section of the web.config has to be placed in the following structure:


(<http://msdn.microsoft.com/en-us/library/5x77e536.aspx>)
  (<http://msdn.microsoft.com/en-us/library/dayb112d.aspx>)
    (<http://msdn.microsoft.com/en-us/library/y123fsf7.aspx>)


You can obtain more information on how to set this up by visiting the MSDN website. Here is an example obtained from there:

<system.web> </system.web>

Summary

You’ve successfully learned how do you display custom error pages on an asp.net application?. If you run into any issues, double-check the prerequisites and ensure your .Net environment is properly configured.