Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2004-03-22
2
Medium Priority
?
1,005 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
1 Comment
 
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Loops Section Overview
Suggested Courses

877 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