Microsoft KB Archive/829930

= FIX: You receive an &quot;HTTP 404 Error&quot; error message and the custom HTTP handler does not run again after you map Aspnet_asapi.dll to .* =

Article ID: 829930

Article Last Modified on 10/25/2005

-

APPLIES TO


 * Microsoft .NET Framework 1.0
 * Microsoft Visual Studio .NET 2002 Professional Edition
 * Microsoft Visual Studio .NET 2002 Enterprise Architect
 * Microsoft Visual Studio .NET 2002 Enterprise Developer
 * Microsoft Common Language Runtime (included with the .NET Framework) 1.0

-







For a Microsoft .NET Framework 1.1 version of this article, see 834270.



SYMPTOMS
You can configure an HTTP handler to handle all file name extensions that have no mappings. If the handler is configured this way, and you visit a Web site in a virtual directory that contains an application that has no mappings for a specific file name extension, the handler can write a response or redirect your browser as necessary.

However, if you visit a Web site in a virtual directory that contains an application that has no mappings for a specific file name extension, you may receive an &quot;HTTP 404 Error&quot; error message instead.



CAUSE
This problem may occur if you visit a URL for a default file that is located in a subfolder that does not exist in the virtual directory that is mapped to the handler.

The first time that your browser requests the URL, the handler responds as expected. If you try to visit a specific .aspx page in the same non-existent folder, you receive an &quot;HTTP 404 Error&quot; error message. This is also the expected behavior.

However, if you try to request the original URL that the handler responded to, regardless of whether you reload the page, you receive an &quot;HTTP 404 Error&quot; error message for that request instead of the response from the handler that you received on the first visit. The handler will not run again until Microsoft ASP.NET is recycled.



RESOLUTION
A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Only apply it to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next Microsoft .NET Framework 1.0 service pack that contains this hotfix.

To resolve this problem immediately, contact Microsoft Product Support Services to obtain the hotfix. For a complete list of Microsoft Product Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:

http://support.microsoft.com/contactus/?ws=support

Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.   Date         Time   Version       Size       File name -  16-Oct-2003  19:22  1.0.3705.462    200,704  Aspnet_isapi.dll 16-Oct-2003 19:16                    4,169  Aspnet_perf.h   16-Oct-2003  19:22                  513,302  Aspnet_perf.ini 16-Oct-2003 19:22                  510,714  Aspnet_perf2.ini 16-Oct-2003 19:22                   24,576  Aspnet_regiis.exe 16-Oct-2003 19:22  1.0.3705.462     28,672  Aspnet_wp.exe 16-Oct-2003 18:37  1.0.3705.462     69,632  Corperfmonext.dll 17-Jun-2003 22:43                   16,597  Installpersistsqlstate.sql 17-Jun-2003 22:43                   17,331  Installsqlstate.sql 09-Sep-2003 01:28                   17,807  Installsqlstatetemplate.sql 16-Oct-2003 18:35  1.0.3705.462    303,104  Mscorjit.dll 17-Oct-2003 16:58  1.0.3705.462  1,953,792  Mscorlib.dll 16-Oct-2003 18:28                   10,284  Mscorlib.ldo 16-Oct-2003 18:36  1.0.3705.462  2,273,280  Mscorsvr.dll 16-Oct-2003 18:36  1.0.3705.462  2,269,184  Mscorwks.dll 16-Oct-2003 19:19  1.0.3705.462     20,480  Perfcounter.dll 23-Aug-2002 03:23                       15  Smartnav.htm 30-Jul-2003 01:04                    8,728  Smartnav.js   17-Oct-2003  16:57  1.0.3705.462  1,175,552  System.dll 17-Oct-2003 16:57  1.0.3705.462    241,664  System.messaging.dll 17-Oct-2003 16:57  1.0.3705.462    311,296  System.runtime.remoting.dll 17-Oct-2003 16:56  1.0.3705.462    131,072  System.runtime.serialization.formatters.soap.dll 17-Oct-2003 16:58  1.0.3705.462  1,196,032  System.web.dll 17-Oct-2003 16:57                  507,904  System.web.services.dll 17-Oct-2003 16:58                1,302,528  System.xml.dll 17-Oct-2003 16:55  1.0.3705.462     32,768  Tlbimp.exe 17-Jun-2003 22:43                    1,419  Uninstallpersistsqlstate.sql 09-Sep-2003 01:28                    2,119  Uninstallsqlstatetemplate.sql 17-Oct-2003 16:55                   65,536  Wsdl.exe



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the &quot;Applies to&quot; section.



MORE INFORMATION
For more information about the terminology that is used to describe Microsoft product updates, click the following article number to view the article in the Microsoft Knowledge Base:

824684 Description of the Standard Terminology That Is Used to Describe Microsoft Software Updates

Steps to reproduce the behavior
 Create an HTTP handler. To do this, create a file that is named HandlerError.cs by using the source code that appears at the end of this section.

For more information about how to create an HTTP handler, see the &quot;References&quot; section of this article. Create a new Visual C# library project, and then add the file that you created in step 1 to this project. Create a new C# ASP.NET Web Form application that is named test.

Note You can make both this project and the project that you created in step 2 part of the same solution.  Add the handler that you created in step 1 to the Web.config file that was created as a part of the Web Form application that you created in step 3. To do this, add the following code to the Web.config file. <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?> <system.web> <httpHandlers> <add verb=&quot;*&quot; path=&quot;*&quot; type=&quot;test.HandlerError,test&quot; /> </httpHandlers> . . . <system.web> </li> Use Microsoft Internet Information Services (IIS) Configuration Manager to map all the unknown file name extensions for the Web Form application that you created in step 3 to the Aspnet_isapi.dll file. To do this, follow these steps: <ol style="list-style-type: lower-alpha;"> At a command prompt, type inetmgr.exe, and then press ENTER to open IIS Configuration Manager.</li> Locate and then click the application that you created in step 3.</li> Right-click the application, and then click Properties.</li> In the Properties dialog box, click the Virtual Directory tab.</li> On the Virtual Directory tab, click Configuration.</li> In the Configuration dialog box, click the Mappings tab.</li> On the Mappings tab, click Add.</li> In the Executable text box, type the path of the Aspnet_isapi.dll file. For example, type the following:

C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\aspnet_isapi.dll

</li> In the Extension text box, type the following, depending on your operating system: <ul> Type .* if your computer runs Microsoft Windows XP.</li> Type * if your computer runs Microsoft Windows 2000.</li></ul> </li> Click to clear the Check that file exists check box.</li> In all open dialog boxes, click OK until you return to the main IIS Configuration Manager window, and then quit IIS Configuration Manager.</li></ol> </li> In your browser, open a default file in a subfolder that does not exist under the virtual directory that was created as a part of the Web Form application that you created in step 3. For example, type the following in the address bar and then press ENTER:

http://localhost/test/folder

You receive the following response from the handler:

Handler Entered:

</li> <li>In your browser, open the following file:

http://localhost/test/folder/file.aspx

You receive an &quot;HTTP 404 Error&quot; error message.</li> <li>In your browser, open the following file again, and then reload the page:

http://localhost/test/folder

You receive an &quot;HTTP 404 Error&quot; error message instead of the response from the handler that you received in step 6.</li></ol>

Code for HandlerError.cs
using System; using System.Web;

namespace test {

public class HandlerError: IHttpHandler {

bool IHttpHandler.IsReusable {                       get {return false;} }

public HandlerError {                       //                        // TODO: Add constructor logic here. //               }

void IHttpHandler.ProcessRequest(HttpContext context) {                       context.Response.Write(&quot;Handler Entered:&quot;); }       } }

<div class="references_section">