Response.flush question

L

Luiz Vianna

Guys,

I need to send some info to my client while I'm processing some stuff. The flow will be something like :
-process
-response
-process
-response
....

I imagine to use response.flush (as I did on ASP) but it does not work. See my test code, after sending 2 lines on response, I'm simulating a processing time before sending other 2 lines.

Response.Write("Line1<br>")
Response.Write("Line2<br>")
Response.Flush()
Dim i As Double
Do While i < 1000000000
i += 1
Loop
Response.Write("Line3<br>")
Response.Write("Line4<br>")

What hapens is that Line1 and Line2 comes only after processing time..

Ideas?

Thanks

Luiz
 
M

Michael Pearson

Response.Buffer = true might be overriding your Flush.

Try something like this

Response.Buffer = false
Response.Write("Line1<br>")
Response.Write("Line2<br>")
Response.Flush()
Dim i As Double
Do While i < 1000000000
i += 1
Loop
Response.Write("Line3<br>")
Response.Write("Line4<br>")

Michael
Guys,

I need to send some info to my client while I'm processing some stuff. The flow will be something like :
-process
-response
-process
-response
...

I imagine to use response.flush (as I did on ASP) but it does not work. See my test code, after sending 2 lines on response, I'm simulating a processing time before sending other 2 lines.

Response.Write("Line1<br>")
Response.Write("Line2<br>")
Response.Flush()
Dim i As Double
Do While i < 1000000000
i += 1
Loop
Response.Write("Line3<br>")
Response.Write("Line4<br>")

What hapens is that Line1 and Line2 comes only after processing time..

Ideas?

Thanks

Luiz
 
S

Scott M.

Response.Flush has no meaning if Response.Buffer is false. If buffer is false, then there is nothing to flush, since it is delivered right away.

See my other response for the reason this does not work.

Response.Buffer = true might be overriding your Flush.

Try something like this

Response.Buffer = false
Response.Write("Line1<br>")
Response.Write("Line2<br>")
Response.Flush()
Dim i As Double
Do While i < 1000000000
i += 1
Loop
Response.Write("Line3<br>")
Response.Write("Line4<br>")

Michael
Guys,

I need to send some info to my client while I'm processing some stuff. The flow will be something like :
-process
-response
-process
-response
...

I imagine to use response.flush (as I did on ASP) but it does not work. See my test code, after sending 2 lines on response, I'm simulating a processing time before sending other 2 lines.

Response.Write("Line1<br>")
Response.Write("Line2<br>")
Response.Flush()
Dim i As Double
Do While i < 1000000000
i += 1
Loop
Response.Write("Line3<br>")
Response.Write("Line4<br>")

What hapens is that Line1 and Line2 comes only after processing time..

Ideas?

Thanks

Luiz
 
S

Scott M.

In ASP.NET any code in your code-behind is completely processed before the page is delivered to the client machine. This is why flush is not working as it did in classic asp.

In .NET, the client doesn't get the page until the page creation, render and destruction sequence is completed.
Guys,

I need to send some info to my client while I'm processing some stuff. The flow will be something like :
-process
-response
-process
-response
...

I imagine to use response.flush (as I did on ASP) but it does not work. See my test code, after sending 2 lines on response, I'm simulating a processing time before sending other 2 lines.

Response.Write("Line1<br>")
Response.Write("Line2<br>")
Response.Flush()
Dim i As Double
Do While i < 1000000000
i += 1
Loop
Response.Write("Line3<br>")
Response.Write("Line4<br>")

What hapens is that Line1 and Line2 comes only after processing time..

Ideas?

Thanks

Luiz
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top