Solved

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

Posted on 2004-03-22
2
982 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

What is an ISAPI filter?   •      It's an assembly (.dll file) that can add or change the way IIS works.   •      They can be enabled globally for your web server or on a site-by-site basis.   When the IIS server receives a request, enabling the ISAPI fi…
Debug Tools to analyse IIS process: This article focus on taking memory dumps from IIS to determine which code is taking more time and to analyse which calls hangs/causes more CPU usage. To take dumps,download the following. Install1: To st…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

816 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now