Response.flush question

  • Thread starter Thread starter Luiz Vianna
  • Start date Start date
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
 
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
 
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
 
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
 
Back
Top