Session state has created a session id, but cannot save it because the response was already flushed

G

ganeshd

Hi,

I've just upgraded my app from ASP.NET 1.1 to 2.0 and am sporadically
seeing this error:

Session state has created a session id, but cannot save it because the
response was already flushed by the application


I use Response.Flush() in my appplication and also have a session
variable in my Session_Start event, but I've never seen this error
before in 1.1. Can someone tell me if the Response.Flush behavior has
changed in 2.0, and if yes, how I can work around this error in 2.0?

Thanks in advance.

Cheers,
Ganesh.
 
G

Guest

I would not recommend attempting to create Session items in the Session_Start
handler. In ASP.NET 2.0, a session does not become alive until you add an
item to it, and attempting to do so in Session_Start is a "catch-22"
situation.
Peter
 
B

Bruce Barker

session state id is stored in a cookie. the cookie is a header, and must be
written before any content. if you do a flush, no headers can be written. in
1.1 if buffering was on (the default), flushes were not honored.

-- bruce (sqlwork.com)
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top