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.
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.
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.
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.
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.
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.
OWScott
286 Posts
Custom vs. Detailed Error messages
May 23, 2007 01:30 AM|LINK
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
Microsoft MVP - IIS
Vaasnet
www.vaasnet.com
ksingla
1138 Posts
Microsoft
Re: Custom vs. Detailed Error messages
May 24, 2007 06:04 PM|LINK
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
OWScott
286 Posts
Re: Custom vs. Detailed Error messages
May 26, 2007 02:28 AM|LINK
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
Microsoft MVP - IIS
Vaasnet
www.vaasnet.com
OWScott
286 Posts
Re: Custom vs. Detailed Error messages
May 26, 2007 03:03 AM|LINK
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
Microsoft MVP - IIS
Vaasnet
www.vaasnet.com
ksingla
1138 Posts
Microsoft
Re: Custom vs. Detailed Error messages
May 27, 2007 07:01 PM|LINK
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