how to Set Custom Error Page in Web.Config?

Let me explain how to set custom error page in web.config or display custom error page in in case URL pattern not matched or redirect to default error page in case non existing pages. By enabling custom Errors in web.config file we can display or redirect to custom error page whenever error throws in application.

<customErrors mode="On" redirectMode="ResponseRewrite">
<error statusCode="404" redirect="404.aspx" />


<httpErrors errorMode="Custom">
<remove statusCode="404"/>
<error statusCode="404" path="/404.aspx" responseMode="ExecuteURL"/>

Leave a Reply

Your email address will not be published. Required fields are marked *