views:

77

answers:

1

I have an ASP.Net website and I want to use a custom error page. I put the following code in my web.config

<customErrors mode="On" defaultRedirect="~/error.aspx">
    <error statusCode="404" redirect="~/error.aspx" />
</customErrors>

The problem is when i go to a URL that does not exist is still uses the 404 error page specified in IIS Manager.

Question: How can I make it use the error.aspx page I have created? Why do the settings in IIS Manager override the web.config?

A: 

Try this way, almost same.. but that's what I did, and working.

<configuration> <system.web>
 <customErrors mode="On" defaultRedirect="apperror.aspx"/>
 <error statusCode="404" redirect="404.aspx" />
 <error statusCode="500" redirect="500.aspx" /> </system.web> </configuration> 

or try to change the 404 error page from IIS settings, if required urgently.

Hrushikesh
If I have the <error> tag outside of the <customError> tags I get an error.I have to put a closing </customError> tag after the error tags but it still does not work.
Yeodave