Content-location Header Is Not Returned to Client when Default.asp Is Default Document (245099)



The information in this article applies to:

  • Microsoft Internet Information Services version 6.0
  • Microsoft Internet Information Server 4.0
  • Microsoft Internet Information Server 5.0

This article was previously published under Q245099

SYMPTOMS

When you make a request to a Microsoft Internet Information Server (IIS), if the IIS is setup to use Default.htm as the default document (or any other HTML document), the resulting "content location" is returned to the client. However, when IIS is setup to use Default.asp as the default document (or any other .asp document), then the "content location" header is not sent to the client in the response from the server. This behavior is by design.

CAUSE

The content-location is an optional entity-header field. It is used to define meta- information about the entity-body with information about the resource identified by the request.

When the Default document is an HTM file IIS returns the content location header. When the Default document is an ASP file it is processed by an ISAPI (ASP.dll) and even though it is a Microsoft DLL it still does processing on behalf of the Web developer. This is very similar to the concept that as a "CGI application" all CGI applications are required to build their own headers.

RESOLUTION

Adding the following ASP code inserts the content-location header into the default ASP document:
<% Response.AddHeader("Content-Location","http://" + Request.ServerVariables("HTTP_HOST") + ":" + Request.ServerVariables("SERVER_PORT") + Request.ServerVariables("SCRIPT_NAME"));%>
				

REFERENCES

For additional information, see the following article or articles in the Microsoft Knowledge Base:

218180 Internet Information Server Returns IP Address in HTTP Header (Content-Location)

244998 Port Number Is Not Returned with Content Location when Specified by URL


Modification Type:MinorLast Reviewed:7/15/2004
Keywords:kbprb KB245099