PRB: #exec Directive with IIS Buffering Displays HTTP Headers in Browser (290569)



The information in this article applies to:

  • Microsoft Internet Information Services 5.0
  • Microsoft Internet Information Server 4.0
  • Microsoft Internet Information Server 4.0 (Spanish version)
  • Microsoft Visual InterDev 1.0
  • Microsoft Visual InterDev 6.0

This article was previously published under Q290569
We strongly recommend that all users upgrade to Microsoft Internet Information Services (IIS) version 6.0 running on Microsoft Windows Server 2003. IIS 6.0 significantly increases Web infrastructure security. For more information about IIS security-related topics, visit the following Microsoft Web site:

SYMPTOMS

When you utilize the Server Side Include (SSI) #exec directive to call an Active Server Pages (ASP) page, and buffering is enabled, the content is processed and loaded but the ASP page also displays the HTTP headers.

The syntax is as follows:
#EXEC CGI = "/YOUR.ASP"
				

CAUSE

The HTTP headers appear with the #exec command when it calls an ASP page that has buffering enabled. Because the buffering stores all data that is created when the ASP is processed, and #exec calls everything from the buffer, the ASP page includes the HTTP headers. If buffering is not enabled, the request is processed as it would be in response to any other client (that is, without displaying the HTTP headers).

RESOLUTION

There are three ways to work around this problem:
  • Turn off buffering in IIS. To do this, follow these steps:
    1. In the IIS Microsoft Management Console (MMC), right-click the Web site and click Properties.
    2. Click the Home Directory tab and click Configuration.
    3. Click the App Option tab and clear Enable Buffering.
  • Turn off buffering on the called pages. To do this, set Response.Buffer to False at the top of the pages that #exec calls. This causes buffering to be turned off on these pages, but still allows buffering for the site.
  • Flush the buffer before it responds to #exec. To do this, place the Response.Flush command at the top of the pages that #exec calls.

MORE INFORMATION

Buffering refers to when script commands are processed and stored before content is sent to the client. You can enable buffering in IIS either through IIS management tools or by using the Response.Buffer = true command on the page.

When buffering is enabled in IIS, buffering is set on all pages. In IIS version 4.0 buffering is turned off by default; in IIS version 5.0, buffering is turned on by default.

Modification Type:MinorLast Reviewed:6/22/2005
Keywords:kbprb KB290569