BUG: HTTP 405 "Method Not Allowed" Error From Default Document

ID: Q216493


The information in this article applies to:


SYMPTOMS

When browsing the default document without specifying the file name (for example, http://Server/Web/), the following error occurs if the Scripting Object Model (SOM) is enabled and a DTC event is called:

HTTP Error
405 Method Not Allowed

The method specified in the Request Line is not allowed for the resource identified by the request. Please ensure that you have the proper MIME type set up for the resource you are requesting.

Please contact the server's administrator if this problem persists.


CAUSE

When the Scripting Object Model is enabled for the page, a <FORM> tag , similar to the following is inserted in the page:


<FORM name=thisForm METHOD=post> 

Since there is no ACTION attribute specified in the tag, both Netscape Navigator and Internet Explorer will attept an HTTP POST to the URI "web/". And, per the HTTP RFC (RFC 2068), this is not a valid Request-URI for a POST operation.


RESOLUTION

You can work around this bug one of two ways:

  1. Redirect from the default document to a different document. In this case, the SOM-enabled document will no longer be the default. The new default document will simply redirect to the SOM-enabled document. For example, if your SOM-enabled document is called MyDefault.asp. Then the default document (Default.asp) would contain only the following:
    
      <%
      Response.Redirect "mydefault.asp"
      %> 


  2. Use client-side script to ensure that the file name is included in the URL. If you must use an SOM-enabled document as the default document, you can work around this bug by placing a client-side code block that does the following location replacement as the first code block within the <HEAD> section of the page:
    
    <SCRIPT Language=JavaScript>
      var loc = document.location.toString()
      var loclen = loc.length
      
      var filename = "default.asp"     //name of default document
      var filelen = filename.length
      
      loc = loc.substring(loclen - filelen, loclen)
      
      if (loc.toUpperCase() != filename.toUpperCase()) { 
        location.replace(filename) 
      }
    </SCRIPT> 



STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.


REFERENCES

Q191276 BUG: "HTTP 405" Error When Default Page is Requested

Additional query words:


Keywords          : kbASP kbCtrl kbVisID600 kbVisID600bug kbGrpASP 
Version           : WINDOWS:6.0
Platform          : WINDOWS 
Issue type        : kbbug 

Last Reviewed: March 4, 1999