Using Custom Error Page in Asp.Net

Redirecting User to a Special Page When Error Occurs

Although we do our best to avoid errors in our Asp.Net pages, we may encounter unexpected errors at runtime.

When an error occurs, it will not be pleasant for the user to see the. Net error pages and the codes of our page. That's why we can use custom error pages. 

First of all, prepare the page to show when error occurs. On this page, you can optionally include a message apologizing to the user, a form to report the problem, and a link to return to the previous page.

Then add the following codes in the system.web field in your web config page:

<system.web>
    <customErrors mode="On" defaultRedirect="hata.aspx"/>
 
</system.web>

When an error occurs on any page on our site, the user will be redirected to the error.aspx page.

using custom error page in asp.net, error page creation, redirect to page when error occurs

EXERCISES

There are no examples related to this subject.



COMMENTS




Read 923 times.

Online Users: 315



asp-net-custom-error-page