Did you know: How IIS 6.0 handles Custom Errors when aspnet_isapi.dll is mapped as a wildcard extension?

by vivek 3/23/2010 7:33:34 AM

Sometime back I came across a very good question on ServerFault and I thought of doing some research to understand how IIS handles Custom Errors setting when all requests are passed through aspnet_isapi.dll.

Here is a brief background:

Scenario 1:

We have a Wildcard mapping configured for aspnet_isapi.dll with “Verify that file exists” unchecked.

image1

We also have Custom Errors configured for 404. We have configured it as a URL and the path is /404/. Remember the path 404 does not exists in wwwroot (or the Web site content folder).

image2

Here’s my observation:

  1. When you add "Wildcard mapping" for aspnet_isapi.dll with "Verify that file exists" unchecked, all the request actually passes through the .net pipeline
  2. When you access a fake directory, .net actually looks for all .config files.. i.e. machine.config, root web.config (that's in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG) and your Web site root directory to look for a possible HttpHandler that can handle your request
  3. Since none of the handler's are configured to handle "directory" request, the request falls back on IISGeneral: GENERAL_STATIC_FILE_HANDLER and fails with 0x80070002 i.e. FILENOTFOUND
  4. Since you have IIS Custom Errors 404 configured as /404/, it looks into the directory c:\inetpub\wwwroot\404\, fails with another 0x80070002 and sends a generic The system cannot find the file specified. error.
  5. When you access a fake main.aspx page, .aspx request is handled in the root web.config file and hence you see a .net specific (The resource cannot be found.) error.

Scenario 2:

We now change the Wildcard mapping configured for aspnet_isapi.dll with “Verify that file exists” as checked.

image3

Here’s what changes:

  1. Now, when you check "Verify that file exists" for the "Wildcard mapping", the server checks that the requested script exists before mapping an extension to an application
  2. Hence, the request never passes through the .net pipeline and gives you the error as stated in point 4 above.

Hope this helps,
Vivek Kumbhar


Quote of the day:
Philosophy is a battle against the bewitchment of our intelligence by means of language. - Ludwig Wittgenstein


blog comments powered by Disqus

Rahul Soni

Rahul Soni  Twitter

 LinkedIn

 Facebook

 Email me



Vivek Kumbhar

Vivek Kumbhar  Twitter

 LinkedIn

 Facebook

 Email me


Stack Exchange

profile for Vivek at Server Fault, Q&A for system administrators and IT professionals

profile for Rahul Soni at Stack Overflow, Q&A for professional and enthusiast programmers

Calendar

<<  February 2012  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
2728291234
567891011

View posts in large calendar

All Items
Sign in

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
© Copyright 2012, Rahul Soni

Powered by BlogEngine.NET 1.4.5.0