Response buffering controls whether generated page output is held on the server or sent progressively to the client. With buffering enabled, ASP can accumulate output and later flush, clear or redirect before the buffered response is committed.
If buffering is disabled, output can be sent as it is generated. When buffering is enabled, output is held until the page completes or Response.Flush sends it. Current IIS Classic ASP configuration enables buffering by default.
<%@ Language=VBScript %>
<% Option Explicit %>
<% Response.Buffer = TRUE %>
<html><head>
<title>(Type a title for your page here)</title>
</head>
<body >
<%
Dim i,j
Response.Write(now)
For i=1 to 10000000
j= j+1 'to waste some time
Next
Response.Write "<br>" & now
%>
</body>
</html>
Here in the above code two places the data or the output is to be posted to the user browser. Both the data are current date and time. So we can see the difference in seconds. If in your case the difference is too short or too high then adjust the looping number by changing number if zeros in for loop. Here you can see the for loop is there only to add some delay between two response.write statements printing the date and time to the user screen.
Note: The loop in this example only creates a visible delay for learning purposes; it is not a production waiting technique.
Here both times or time outputs are stored in buffer and posted at one go once the script execution is over.<% Response.Buffer = False %>
You can see the difference as first one output of time will come and after some time the other out put of time will come ( change the value of looping in for loop if gap is more or too less, this is to adjust delay ). Here each line is posted immediately without waiting for the full page to complete its execution.
Response object error 'ASP 0156 : 80004005'
Header Error
The HTTP headers are already written to the client browser. Any HTTP header modifications must be made before writing page content.
Similarly we can't make buffer False when it is On before and send some output in between. Here is the error message we will get
Response object, ASP 0157 (0x80004005)
Buffering cannot be turned off once it is already turned on.
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.