ASP.Net/Response/Buffer

Материал из .Net Framework эксперт
Перейти к: навигация, поиск

Buffering Output (VB.net)

<%@ Page Language="vb" %>
<html>
   <head>
      <title>Buffering Output in ASP.NET</title>
      <script runat="server">
         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 &= "."
            Next
            Response.Write("<br>Done!<br>")
            Message.Text &= "<br>Done!<br>"
         End Sub
      </script>
   </head>
<body>
   <asp:label id="Message" runat="server"/>
</body>
</html>



Clearing buffered output (VB.net)

<%@ Page Language="vb" %>
<html>
   <head>
      <title>Clearing buffered output in ASP.NET</title>
      <script runat="server">
         Sub Page_Load()
            Response.Write("This content will not be seen.")
            Response.ClearContent()
            Message.Text = "Content written with <i>Response.Write</i> was cleared."
         End Sub
      </script>
   </head>
<body>
   <asp:label id="Message" runat="server"/>
</body>
</html>