Question How to make a custom error page?

raysefo

Well-known member
Joined
Jul 21, 2010
Messages
207
Programming Experience
Beginner
Hi,

Is there a way to make a custom error page? I mean, if there is an error, i would like to inform user by redirecting to this error page. Any suggestions how to implement this?

thanks in advance..

best regards.
 
You can make a 404 type page but to have the user directed to it you set that stuff in IIS (the web server) itself, though there is the redirect stuff you can put in web.config but I've heard most hosts have IIS set up to ignore the web.config error redirects and use what's specified in IIS itself.

Here's some of the things you can try in the web.config file:
VB.NET:
<customErrors defaultRedirect="ErrorPage.aspx" mode="On">   
    <error statusCode="500" redirect="servererror.aspx" />
    <error statusCode="404" redirect="filenotfound.aspx" />
    <error statusCode="403" redirect="AccessDenied.aspx" /> 
</customErrors>
I think for that to work you have to set <customErrors mode="On" /> in the config file too, though I dont know about that.
 
Back
Top