从ASP了解Http Buffer
2014-03-11 13:58
113 查看
he Buffer property specifies whether to buffer the output or not. When the output is buffered, the server will hold back the response to the browser until all of the server scripts have been processed, or until the script calls the Flush or End method.
Note: If this property is set, it should be before the <html> tag in the .asp file
<%response.Buffer=true%>
<html>
<body>
<%
for i=1 to 100
response.write(i & "<br>")
next
%>
</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>
<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>
Note: If this property is set, it should be before the <html> tag in the .asp file
Syntax
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. |
Examples
Example 1
In this example, there will be no output sent to the browser before the loop is finished. If buffer was set to False, then it would write a line to the browser every time it went through the loop.<%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
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>
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>
相关文章推荐
- asp.net 了解 Sessin
- asp(了解即可)
- 了解 ASP.NET AJAX Web 服务(五)
- [翻译]了解ASP.NET底层架构(完)
- 从底层了解ASP.NET体系结构
- 了解ASP.NET底层架构
- 了解asp.net中的缓存和存储过程
- 了解ASP.NET MVC几种ActionResult的本质:JavaScriptResult & JsonResult
- 了解ASP.NET MVC几种ActionResult的本质:JavaScriptResult & JsonResult
- 了解ASP.NET MVC几种ActionResult的本质:JavaScriptResult & JsonResult
- 了解ASP.NET MVC几种ActionResult的本质:JavaScriptResult & JsonResult
- ADO.NET .net core2.0添加json文件并转化成类注入控制器使用 简单了解 iTextSharp实现HTML to PDF ASP.NET MVC 中 Autofac依赖注入DI 控制反转IOC 了解一下 C# AutoMapper 了解一下
- Asp.net 站點導航簡單了解
- 【翻译】了解ASP.NET MVC中的Ajax助手
- (翻译)从底层了解ASP.NET体系结构
- ASP.NET Core 1.0 入门——了解一个空项目
- 了解ASP.NET底层架构
- 全面了解ASP注入方法
- 了解使用 ASP.NET AJAX 进行局部页面更新1
- (翻译)从底层了解ASP.NET体系结构