Latest web development tutorials

ASP Buffer property

Response Object Reference Complete Response Object Reference

Buffer attribute specifies whether output is buffered. Normally, ASP script is executed on the server, each sentence of execution results are sent to be displayed on the client browser. When the output buffer is set, the server will prevent a response to the browser until all of the server scripts have been processed, or until the script calls the Flush or End method.

Note: If you set this property, it should come before the .asp file <html> tag.

grammar

response.Buffer[=flag]

参数 描述
flag 布尔值,规定是否缓冲页面输出。

False 指示不缓存,服务器会一边处理一边发送输出。IIS version 4.0 默认为 False,而 IIS version 5.0 及更高的版本默认为 True。

True 指示缓冲。服务器不会发送输出,直到页面上的所有脚本被处理,或者直到 Flush 或 End 方法被调用。

Examples

Example 1

In this example, before the end of the cycle will not be sent by the browser output. If the buffer is set to False, then once per cycle to the output line of the browser.

<%response.Buffer=true%>
<html>
<body>
<%
for i=1 to 100
response.write(i & "<br>")
next
%>
</body>
</html>

Example 2

<%response.Buffer=true%>
<html>
<body>
<p>I write some text, but I will control when
the text will be sent to the browser.</p>
<p>The text is not sent yet. I hold it back!</p>
<p>OK, let it go!</p>
<%response.Flush%>
</body>
</html>

Example 3

<%response.Buffer=true%>
<html>
<body>
<p>This is some text I want to send to the user.</p>
<p>No, I changed my mind. I want to clear the text.</p>
<%response.Clear%>
</body>
</html>


Response Object Reference Complete Response Object Reference