Solved

IIS does not respond to <error statusCode="404" redirect="~/Errors/Error404.aspx" />.  Other errors do. Why?

Posted on 2004-03-22
2
986 Views
Last Modified: 2012-05-04
The system.web part of my web.config file has the following :

            <customErrors defaultRedirect="~/Errors/GeneralError.html" mode="On">
                  <error statusCode="404" redirect="~/Errors/Error404.aspx" />
                  <error statusCode="403" redirect="~/Errors/Error403.aspx" />
            </customErrors>

The error 403 page is correctly called when I try to access, for example the web.config file with the browser. However, I cannot get the dyamic 404 page to be called - the IIS default is called instead.

Can anyone explain what on earth is going wrong? It looks so simple in principle!

In my application, the 404 custom error must be configured from the web.config file. A direct change to the IIS would otherwise do the job, but this is not an option.

Thanks.
0
Comment
Question by:Daeljan
2 Comments
 
LVL 2

Accepted Solution

by:
Daeljan earned 0 total points
ID: 10655982
Ok, the answer to this question is that unless the requested URL ends in ".aspx", the 404 error will not be handled by the application. When it ends in ".aspx", IIS calls the designated page with the URL argument "aspxerrorpath=<filename>.aspx".

If you want to avoid this ugly URL, or extend the error handling beyond aspx pages, then you have to speak nicely with your site hosting company and ask them to change the configuration of IIS to call a particular URL when error 404 is generated.

Personally, I think the dynamic 404 error handling could have been better implemented.

A little more information may be found at: http://www.aspwarp.com/customerrors.aspx

As I have answered my own question, I'd like to close this now and have my points refunded.

Thanks.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here are the symptoms: You start receiving calls from users that one of your legacy web apps isn't coming up, so you log into your IIS 5 server to check it out.  When you pull up the services, you notice that the WWW Publishing service isn't runn…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question