Tuesday, April 13, 2010

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

Session state has created a session id, but cannot save it because the response was already flushed by the application.
??
I m trying to generate an aspx page
that renders a db rrecord and outputs xml
so i use response.flush

this gives error like titled on the top
this was because asp.net takes sessionid in cookie variable
and when i put response.flush
it goes to error

fixing??? put session_start code in global.asax
protected void Session_Start(object sender, EventArgs e)
{
// Code that runs when a new session is started

//Ensure SessionID in order to prevent the folloing exception
//when the Application Pool Recycles
//[HttpException]: Session state has created a session id, but cannot
// save it because the response was already flushed by
string sessionId = Session.SessionID;

}

details
look

No comments: