Cookies and buffering

R

Robert Scheer

Hi.

Can anyone tell me if and why is it really necessary to enable
buffering to create cookies? I read the MSDN topics about
response.cookies and response.redirect and there is no line saying
that response.buffer = true is necessary. I am confused.

Thanks,
Robert Scheer
 
K

Ken Schaefer

Cookies are sent as part of the HTTP headers (along with other headers, such
as the HTTP Status, Expiry and Caching information). This needs to be sent
*before* any HTTP body information (usually starting with <html> or
<!DOCTYPE>).

If you try to set a cookie after you have sent body information, then you
need to have Response Buffering on. This allows IIS to hang onto all the
info until server-side processing has finished, organise everything into the
correct order (HTTP Headers first, then HTTP Body information), and send it
all out at once.

Cheers
Ken

: Hi.
:
: Can anyone tell me if and why is it really necessary to enable
: buffering to create cookies? I read the MSDN topics about
: response.cookies and response.redirect and there is no line saying
: that response.buffer = true is necessary. I am confused.
:
: Thanks,
: Robert Scheer
 

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

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,019
Latest member
RoxannaSta

Latest Threads

Top