Thread: Response.Flush
View Single Post
  #2 (permalink)  
Old October 20th, 2003, 08:39 AM
Imar's Avatar
Imar Imar is offline
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Nope. This is by design. When you send output to the browser, you actually send an HTTP Header and a HTTP Body. Cookies, Redirect statements, etc are placed in the header. The page contents are send in the body.

For technical reasons, the header must be sent before the body. So, as soon as you flush some content to the browser, the header must already have been sent, so you can't access or modify it anymore with a Response.Redirect statement.

You can, however, simulate this with some JavaScript. Instead of the Redirect statement, send some JavaScript that requests a new page using location.href.

HtH,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.