ASP Buffer Attribute
The Buffer property specifies whether the output is buffered. Normally, ASP scripts are executed on the server side, and the execution result of each sentence is sent to the client's browser for display. When the output is buffered, the server will block the response to the browser until all the server scripts have been processed, or until the script calls the Flush or End method.
Note:If you need to set this property, it should be located before the <html> tag in the .asp file.
Syntax:
response.Buffer[=flag]
Parameter | Description |
---|---|
flag |
A boolean value that specifies whether the page output is buffered. False indicates no buffering, and the server will send output while processing. The IIS version 4.0 default is False, while IIS version 5.0 and higher default to True. True indicates buffering. The server will not send output until all the scripts on the page have been processed, or until the Flush or End method is called. |
Instance
Example 1
In this example, the output is not sent to the browser before the loop ends. If the buffer is set to False, a line of output will be sent to the browser with each iteration.
<%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 <p>The text will be sent to the browser.</p> <p>The text has not been sent yet. I am holding 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>