what are the different ways in which you can show / display custom errors in ASP.NET ?

Answer

Custom errors can be displayed in many different ways. the 3 common ways that I know of, are.

  1. Across the application, for all errors, you can show custom errors by setting the defaultRedirect property for the <customErrors> section in the Web.Config file’s <system.Web> section.
  2. For displaying error messages for specific HTTP status codes, you can set the <error> elements within the section in the Web.Config file’s <system.Web> section and a corresponding error html file in the redirect element.
    <error statusCode="400" redirect="status400error.htm"> 
  3. Finally, at the page level, you can display custom errors by setting the ErrorPage attribute in the page directive at the top in the code view inside visual studio.

, , {0}

Leave a Reply