ASP Bufferプロパティ
完全なResponseオブジェクトリファレンス
Buffer プロパティは、出力をバッファリングするかどうかを指定します。通常、ASP スクリプトはサーバー側で実行され、各ステートメントの実行結果はクライアントのブラウザに送信されて表示されます。出力にバッファリングが設定されている場合、サーバーはすべてのサーバースクリプトが処理されるまで、またはスクリプトが Flush または End メソッドを呼び出すまで、ブラウザへのレスポンスを抑止します。
注意:このプロパティを設定する場合は、.asp ファイル内の <html> タグの前に置く必要があります。
構文
response.Buffer[=flag]
| パラメータ | 説明 |
|---|---|
| flag | ページ出力をバッファリングするかどうかを指定するブール値。 False はバッファリングしないことを示し、サーバーは処理しながら出力を送信します。IIS version 4.0 ではデフォルトが False ですが、IIS version 5.0 以降のデフォルトは True です。 True はバッファリングすることを示します。サーバーは、ページ上のすべてのスクリプトが処理されるまで、または Flush または End メソッドが呼び出されるまで、出力を送信しません。 |
例
例 1
この例では、ループが終了するまでブラウザに出力は送信されません。buffer が False に設定されている場合は、ループが1回実行されるごとに1行がブラウザに出力されます。
<%response.Buffer=true%>
<html>
<body>
<%
for i=1 to 100
response.write(i & "<br>")
next
%>
</body>
</html>
<html>
<body>
<%
for i=1 to 100
response.write(i & "<br>")
next
%>
</body>
</html>
例 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>
<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>
例 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>
<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オブジェクトリファレンス その他の拡張