« Previous Next »

Thread: Custom vs. Detailed Error messages

Last post 05-27-2007 3:01 PM by ksingla. 4 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (5 items)

Sort Posts:

  • 05-22-2007, 9:30 PM

    • OWScott
    • Top 75 Contributor
    • Joined on 08-12-2002, 1:25 PM
    • North Carolina
    • Posts 88

    Custom vs. Detailed Error messages

    I have a fresh install of B3 with IIS7 installed and the CustomErrorModule installed.

    I find that some errors show the new detailed errors, but some still show the old error message.  For example, notfound.aspx shows the old HTTP 404 error.  But notfound.abc shows the nice new 404.0 error page.  No changes I have made to the Error Pages in inetmgr or in applicationHost.config seem to be taking affect.

    Any ideas why they perform differently and what I need to do so that all errors use the new detailed errors?

    I get the same on the local machine and over the network and I tried changing the mode to "Detailed" but that didn't seem to make a difference.

    Thanks,

    Scott

    Scott Forsyth
    Director of IT
    Microsoft MVP - ASP/ASP.NET
    ASPInsider

    ORCS Web, Inc
    www.orcsweb.com
  • 05-24-2007, 2:04 PM In reply to

    • ksingla
    • Top 25 Contributor
    • Joined on 06-14-2006, 3:02 AM
    • Redmond, WA
    • Posts 863

    Re: Custom vs. Detailed Error messages

    OWScott,

    This is because notfound.aspx request is handled by ASP.Net which is setting a 404 error message. IIS detects that handler returned the error code but gave a non-blank response and doesn't replace it with its own detailed error message. To make IIS always return its own error message even when other handlers/modules returned a non-blank error response, you need to set system.webServer/httpErrors@existingResponse to Replace.

    Kanwal

    Follow me on twitter at http://twitter.com/kjsingla
  • 05-25-2007, 10:28 PM In reply to

    • OWScott
    • Top 75 Contributor
    • Joined on 08-12-2002, 1:25 PM
    • North Carolina
    • Posts 88

    Re: Custom vs. Detailed Error messages

    Thanks Kanwal,

    That explains it. I have to admit that it's not as attractive though. All of the pages that ASP.NET traditionally handles still have the ASP.NET error, so it's only the non ASP.NET errors that have the nice new look.

    I also tested by adding aspxx as a PageHandlerFactory and see that it is now getting the ASP.NET error page.  So, even though IIS handles all requests now, it doesn't use the ASP.NET error handling unless there is a handler for that extension.

    I set existingResponse to Replace and it looks a lot better, but it doesn't pass through a lot of the important information, particularly with 500 error pages. So, the default is the most informative even though the error pages aren't consistent.

    Thanks,

    Scott

    Scott Forsyth
    Director of IT
    Microsoft MVP - ASP/ASP.NET
    ASPInsider

    ORCS Web, Inc
    www.orcsweb.com
  • 05-25-2007, 11:03 PM In reply to

    • OWScott
    • Top 75 Contributor
    • Joined on 08-12-2002, 1:25 PM
    • North Carolina
    • Posts 88

    Re: Custom vs. Detailed Error messages

    Hi Kanwal,

    Ok, I'm back with another question.  I am now familar with existingResponse and when IIS and with ASP.NET are handling the errors.

    But, my original issue is still there.  I can't seem to get IIS to honor any changes to the error pages.  I now have existingResponse="Replace" and test by making sure that test page doesn't have enough permissions to run.  This throws a 401.3 error.  But the error page is always the 401.0 page.  I'v tried everything from the GUI, including pointing to dummy files, but to no avail.

    Here are two examples of what I've tried:

        <system.webServer>
            <httpErrors existingResponse="Replace">
               <clear />
            </httpErrors>
        </system.webServer>

    and

            <httpErrors existingResponse="Replace">
               <clear />
                <error statusCode="401" subStatusCode="3" path="C:\inetpub\custerr\en-US\403-19.htm" responseMode="File" />
            </httpErrors>

    Notice that I'm specifically checking for 401.3 and I'm pointing to a valid file, but it's a different file.  Nothing changes though, no matter what I do.

    Thanks,

    Scott

    Scott Forsyth
    Director of IT
    Microsoft MVP - ASP/ASP.NET
    ASPInsider

    ORCS Web, Inc
    www.orcsweb.com
  • 05-27-2007, 3:01 PM In reply to

    • ksingla
    • Top 25 Contributor
    • Joined on 06-14-2006, 3:02 AM
    • Redmond, WA
    • Posts 863

    Re: Custom vs. Detailed Error messages

    Scott,

    Decision to provide a way for Asp.Net to override IIS custom errors was made exactly for that reason (to allow Asp.Net and Indigo to return detailed error information, mainly exceptions to clients). Yes, exitingResponse default "Auto" doesn't give you consistent error pages but are most informative.

    Regarding your custom error settings not getting picked, are you sending requests from the local machine? You might need to change errorMode to Custom to tell custom errors module to not do detailed errors for local requests or send requests from a remote machine which makes custom error module behave as if errorMode is Custom when it is set to DetailedLocalOnly (default value). Also make sure you are correctly generating 401.3 by checking log files.

    Another thing you might want to do is use <remove statusCode="401" subStatusCode="3"/> to replace 401.3 custom error instead of using <clear/> which clears out settings of all other status codes. If errorMode is Custom and if there is no error configured for status.substatus, we will just return a one line error message which is not substatus code specific.

    -Kanwal

    Follow me on twitter at http://twitter.com/kjsingla
Page 1 of 1 (5 items)
Microsoft Communities