How to Disable the ASP.NET v4.0 Extensionless URL feature on IIS 6.0
You can disable the v4.0 ASP.NET extensionless URL feature on IIS6 by setting a DWORD at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ASP.NET\4.0.30319.0\EnableExtensionlessUrls = 0. After changing the value, you will need to restart IIS in order for us to pick up the change, because it is only read once when IIS starts. Note that for Wow64 (i.e., 32-bit worker process running on 64-bit OS), this registry key must be set at HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\ASP.NET\4.0.30319.0\EnableExtensionlessUrls.
Here’s how the v4.0 ASP.NET extensionless URL features works on IIS 6. We have an ISAPI Filter named aspnet_filter.dll that appends “/eurl.axd/GUID” to extensionless URLs. This happens early on in the request processing. We also have a script mapping so that “*.axd” requests are handled by our ISAPI, aspnet_isapi.dll. When we append “/eurl.axd/GUID” to extensionless URLs, it causes them to be mapped to our aspnet_isapi.dll, as long as the script map exists as expected. These requests then enter ASP.NET where we remove “/eurl.axd/GUID” from the URL, that is, we restore the original URL. The restoration of the original URL happens very early. Now the URL is extensionless again, and if no further changes are made and you’re using the default <httpHandlers> section in web.config, this will be assigned to the DefaultHttpHandler, since it has path=”*” and is the first handler to match the extensionless URL. The DefaultHttpHandler will then redirect this request back to IIS, but this time our filter will not append “/eurl.axd/GUID” and the request will be handled as it would be normally. To do anything interesting with the v4.0 ASP.NET extensionless URL feature, you must change the handler from DefaultHttpHandler to something else, before the MapRequestHandler event fires.
Note that v4.0 aspnet_filter.dll will only enable the extensionless URL feature (by appending eurl.axd to the URL) if the following are true:
- EnableExtensionlessUrls is not defined or has a value of 1.
- v4.0 aspnet_filter.dll is registered as an ISAPI Filter.
- v4.0 aspnet_isapi.dll is script mapped to ".axd" at the web site level (e.g. "/LM/W3SVC/N/ROOT", where N is the siteID).
- v4.0 aspnet_isapi.dll is marked as "Allowed" in the ISAPI Restriction list.
- The web site has read and script permission enabled.
I've heard that it is not compatible with Ionics ISAPI Rewrite Filter, and it may not be compatible with other URL rewriting components. Fortunately the ASP.NET feature is easy to disable. By the way, the most common way for the ASP.NET extensionless URL feature to fail is for it to leave "/eurl.axd/GUID" on the URL. This happens when our aspnet_filter appends “/eurl.axd/GUID”, but we fail to find the “*.axd” script map, and so the request is not mapped to aspnet_isapi.dll, and therefore never enters ASP.NET and we never restore the original URL. As a result, you will receive a 404 response and the URL will have "/eurl.axd/GUID" appended.