tutorial pengembangan web terbaru
 

ASP Buffer Property


<Complete Reference Response Obyek

Properti Buffer menentukan apakah untuk buffer output atau tidak. Ketika output buffer, server akan menahan respon ke browser sampai semua script server sudah diproses, atau sampai script panggilan metode Siram atau End.

Note: Jika properti ini diset, itu harus sebelum <html> tag di file .asp

Sintaksis

response.Buffer[=flag]

Parameter Deskripsi
flag Nilai boolean yang menentukan apakah untuk buffer output halaman atau tidak.

Salah menunjukkan tidak ada buffering. server akan mengirimkan output seperti yang diproses. Palsu adalah default untuk IIS versi 4.0 (and earlier) . Default untuk IIS versi 5.0 (dan kemudian) adalah benar.

Benar menunjukkan buffering. Server tidak akan mengirim output sampai semua skrip pada halaman telah diproses, atau sampai metode Siram atau End telah disebut.

contoh

contoh 1

Dalam contoh ini, tidak akan ada output yang dikirim ke browser sebelum loop selesai. Jika buffer diatur ke False, maka akan menulis satu baris ke browser setiap kali ia pergi melalui loop.

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

contoh 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>

contoh 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>

<Complete Reference Response Obyek