Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Response.Flush Question

Status
Not open for further replies.

Mighty

Programmer
Feb 22, 2001
1,682
US
Guys,

I have a strange problem. I have an ASP page that accesses a database before populating a form with the data. What I want to be able to do is output a message to the browser telling the user that their input is being processed. Then when all the data has been retrieved the form is created and sent to the browser.

I just started simple and have the following at the top of the page:

<%
Option EXPLICIT
Response.Buffer = True
%>

<HTML>
<HEAD>
<TITLE>Client Area - Order Tracking</TITLE>
<HEAD>
<script language=&quot;JavaScript&quot; src=&quot;trackorder.js&quot;></script>
</HEAD>
<BODY BGCOLOR=&quot;#CCCCCC&quot;>
Page is loading.....please be patient<BR>
<%
Response.Flush
%>

My page then works on and when all the processing is complete I do a response.end. (I know this will leave the text above on the screen but I know what to do about that).

The problem is that when I click on the link to open this page, it waits until all the processing is complete before it outputs my &quot;please wait&quot; message and the complete form. However, if I then refresh the page it outputs my &quot;please wait&quot; message and then when the processing is complete it outputs the form.

So why doesn't it work on the initial load when it works on a refresh. All advice greatly appreciated. Mise Le Meas,

Mighty :)
 
It waits to print out your waiting message because you have your Response.Buffer set to true. This basically holds all output until the page is completely processed before sending it to the client.
 
Buffering must be set to true if you use Response.Flush.
To quote Wrox VBScript Programmer's reference:

&quot;If you turn buffering on (by setting this property to true), output will not be sent until all scripts have been executed for the current page, or the flush or end methods are called.&quot; Mise Le Meas,

Mighty :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top