Microsoft KB Archive/245198

From BetaArchive Wiki
Knowledge Base


INFO: Response.Buffer Is ON by Default in Internet Information Services 5.0

Article ID: 245198

Article Last Modified on 6/30/2004



APPLIES TO

  • Microsoft Active Server Pages 4.0
  • Microsoft Internet Information Services 5.0



This article was previously published under Q245198

SUMMARY

In Internet Information Services (IIS) 5.0, the Response.Buffer property is ON (set to TRUE) by default, which is a change from Internet Information Server 4.0. To illustrate this, run the following Active Server Pages (ASP) code in Internet Information Server 4.0 and Internet Information Services 5.0:

<%
    Response.Write "Before" & "<BR>"
    Response.Buffer = FALSE
    Response.Write "After" & "<BR>"
%>
                


When you run this code in Internet Information Services 5.0, the following error message appears:

Response object, ASP 0157 (0x80004005)
Buffering On
Buffering cannot be turned off once it is already turned on.


When you run this code in Internet Information Server 4.0, the following text appears:

Before
After
                    

MORE INFORMATION

This design change gives the following advantages:

  • Improved performance.
  • If an error occurs in your ASP code, IIS displays a custom error page instead of the error message inline in the page.
  • You can set headers and cookies at any point in the page, not just before you send any content.
  • You can also redirect at any point in the page.

The only caveat to buffering is that users have to wait until the entire page is rendered.

To turn buffering off in IIS 5.0:

  1. Start the Internet Service Manager (ISM), which loads the Internet Information Server snap-in for the Microsoft Management Console (MMC).
  2. Right-click the Web site, and then click Properties.
  3. On the Home Directory tab, in the Application Settings section, click Configuration.
  4. On the App Options tab, clear the Enable buffering check box.
  5. Click OK twice to return to the IIS snap-in.


Keywords: kbinfo kbcodesnippet KB245198