Name
BufferOutput
Synopsis
Boolean = Response.BufferOutput Response.BufferOutput = Boolean
Returns or sets a Boolean value that represents whether output is
buffered on the server and sent when the request has completely
finished processing, or when either the Response.Flush or
Response.End methods are called. The default value is
True
.
Parameters
-
Boolean
A Boolean that will receive or set the value of the property.
Example
The example sets the BufferOutput property to
False
and then loops 50 times, writing a period to
the HTTP output with each loop iteration. It also writes the same
output to the Text property of the Message Label control. For the
first 10 and the last 21 iterations, BufferOutput is set to
False
; for iterations 11 through 29, it is set to
True
.
Sub Page_Load( ) Response.BufferOutput = False Dim i As Integer For i = 1 To 50 If (i > 10 And i < 30) Then Response.BufferOutput = True Else Response.BufferOutput = False End If System.Threading.Thread.Sleep(500) Response.Write(".") Message.Text &= "." 'Response.Flush Next Response.Write("<br/>Done!<br/>") Message.Text &= "<br/>Done!<br/>" End Sub
The output of the code would look something like this:
.................................................. Done! .................................................. Done!
The first line of periods should appear one by one until ten have appeared, then pause, and then 20 more should appear, followed one by one by the rest and finally by the “Done!” statement. The identical output produced ...
Get ASP.NET in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.