Solved

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

Posted on 2004-03-22
2
979 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
Comment Utility
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Logparser is the smartest tool I have ever used in parsing IIS log files and there are many interesting things I wanted to share with everyone one of the  real-world  scenario from my current project. Let's get started with  scenario - How do w…
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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

763 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

10 Experts available now in Live!

Get 1:1 Help Now