To buffer or not to buffer

Under IIS 4.0, buffering is disabled by default. This means that your
ASP page is streamed out to the browser as it's processed. This often
gives the illusion of a more responsive page, as a certain amount of
the page can be rendered while time-consuming processes, such as
database calls, are performed; however, the downside is that you can't
redirect to another page once the HTTP headers have been sent to the
browser. This happens immediately, the first time you call
response.write or certain other methods.

Under IIS 5.0, we have the opposite situation: buffering is enabled by
default. This means that the entire ASP page is processed and
interpreted before anything is sent to the browser. Consequently, you
can redirect as often as you like, but users may get to stare at a
blank browser window while your database queries or other time-
consuming script executes.

Both choices are valid in certain circumstances. You can take the
driver's seat by deciding for yourself on a page-by-page basis
which to use. The buffer property of the response object allows
you to exercise programmatic control over this. Simply set

Response.Buffer = True

to turn buffering on, or set the property to false to turn it off.
Experiment to decide which is appropriate for your needs.

You might also like...


ElementK Journals


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Beware of bugs in the above code; I have only proved it correct, not tried it.” - Donald Knuth