How to Control Response Buffering in Classic ASP

Response.Buffer controls when Classic ASP releases generated output. Set it before producing response content. The property belongs to Response. The misspelling Reponse is an error.

Send unbuffered output

Use this small page to exercise the setting:

Visual Basic
<%@ Language="VBScript" %>
<% Option Explicit %>
<%
Response.Buffer = False
Response.ContentType = "text/plain"
Response.Write "First line" & vbCrLf
Response.Write "Second line" & vbCrLf
%>

Request it through IIS. The response body contains two lines in that order. This verifies the content, but it does not prove the browser displayed each write separately because a proxy, compression layer or browser can still buffer received data.

Flush a buffered response explicitly

When the application needs deliberate boundaries, keep buffering enabled and flush the completed portion:

Visual Basic
<%@ Language="VBScript" %>
<%
Response.Buffer = True
Response.ContentType = "text/plain"
Response.Write "First portion" & vbCrLf
Response.Flush
Response.Write "Final portion" & vbCrLf
%>

Response.Flush requires buffering to be enabled. Do not combine it with Response.Buffer = False.

Commit headers before output

Set the content type, cookies and response status before the first unbuffered write or flush. Once output has been sent, the application cannot reliably replace it with a redirect or a clean error response. This is why ordinary pages usually benefit from buffered output.

Removing buffering is not a general performance fix and does not remove every IIS size limit. If the actual problem is a large download or upload, inspect the handler and request limits involved. Avoid artificial busy loops or sleeps in a production ASP request merely to demonstrate streaming.

References

Response.Buffer
https://learn.microsoft.com/en-us/previous-versions/iis/6.0-sdk/ms526001(v=vs.90)
Response.Buffer
Response.Flush Method
https://learn.microsoft.com/en-us/previous-versions/iis/6.0-sdk/ms525560(v=vs.90)
Response.Flush

Author: Herman Schoenfeld