SQL PHP HTML ASP JavaScript articles and free scripts to download
 

Response.Clear removing data in ASP

While using Response.clear we have to first ensure that buffer is On, in all advance versions of ASP by default buffer is on. By using Response.Clear we can remove data from buffer without sending them to client browser. In Response. Clear we have posted the data to browser before deleting from buffer. This is the main difference between Response.clear and response.flush. Here is a simple example of Response.clear

<%@ Language=VBScript %>
<% Option Explicit
Response.Buffer = True

%>

<html><head>
<title>(Type a title for your page here)</title>
</head>
<body >

<%

Response.Write("Message No :1 Before Clear and Flush <br>")
Response.Flush
Response.Write("Message No :2 After Flush and before Clear <br>")
Response.Clear
Response.Write("Message No :3 After Clear and flush <br>")

%>

</body>
</html>

Here we will see two messages only. The Message No 1 and the Message No 3. Message No 1 will go to browser as we have used Response.Flush to send the data after this line. Then Message No 2 is written but after that Response.Clear command will remove it from buffer without sending it. The Message No 3 will reach browser once the script execution is completed.


Post Comment This is for short comments only. Use the forum for more discussions.
Name
Email( not to be displayed)Privacy Policy
1+2=This is to prevent automatic submission by spammers. Please enter the result of the sum as asked

Join Our Email List
Email:  
For Email Newsletters you can trust
Response Object