Proprietà buffer ASP


❮ Riferimento completo all'oggetto di risposta

La proprietà Buffer specifica se memorizzare nel buffer l'output o meno. Quando l'output è memorizzato nel buffer, il server tratterrà la risposta al browser fino a quando tutti gli script del server non sono stati elaborati o finché lo script non chiama il metodo Flush o End.

Nota: se questa proprietà è impostata, dovrebbe trovarsi prima del tag <html> nel file .asp

Sintassi

response.Buffer[=flag]

Parameter Description
flag A boolean value that specifies whether to buffer the page output or not.

False indicates no buffering. The server will send the output as it is processed. False is default for IIS version 4.0 (and earlier). Default for IIS version 5.0 (and later) is true.

True indicates buffering. The server will not send output until all of the scripts on the page have been processed, or until the Flush or End method has been called.

Esempi

Esempio 1

In questo esempio, non verrà inviato alcun output al browser prima che il ciclo sia terminato. Se il buffer è impostato su False, scriverà una riga nel browser ogni volta che passa attraverso il ciclo.

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

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

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

❮ Riferimento completo all'oggetto di risposta