Microsoft KB Archive/245099

= Content-location Header Is Not Returned to Client when Default.asp Is Default Document =

Article ID: 245099

Article Last Modified on 12/3/2007

-

APPLIES TO


 * Microsoft Internet Information Services 6.0
 * Microsoft Internet Information Server 4.0
 * Microsoft Internet Information Services 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"));%>

