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

Discussion in 'ASP .Net' started by ganeshd@gmail.com, Jul 6, 2006.

  1. Guest

    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.
     
    , Jul 6, 2006
    #1
    1. Advertising

  2. RE: Session state has created a session id, but cannot save it because

    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

    --
    Co-founder, Eggheadcafe.com developer portal:
    http://www.eggheadcafe.com
    UnBlog:
    http://petesbloggerama.blogspot.com




    "" wrote:

    > 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.
    >
    >
     
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=, Jul 6, 2006
    #2
    1. Advertising

  3. Bruce Barker Guest

    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)

    <> wrote in message
    news:...
    > 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.
    >
     
    Bruce Barker, Jul 7, 2006
    #3
  4. zz78_gang

    Joined:
    Aug 17, 2007
    Messages:
    1
    I met the same problem in my website

    I soloved it by create a non-useful session in page_load event.
    So, Session has available before Response.Flush().


    http://inn.city366.com/
     
    zz78_gang, Aug 17, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bob of the West
    Replies:
    1
    Views:
    2,960
    William F. Robertson, Jr.
    May 17, 2004
  2. =?Utf-8?B?cGVycGVy?=
    Replies:
    1
    Views:
    860
    Patrice
    Mar 22, 2005
  3. PL
    Replies:
    2
    Views:
    3,229
  4. Replies:
    1
    Views:
    18,123
  5. Stewart
    Replies:
    4
    Views:
    5,927
    rajeshmuthu
    May 13, 2009
Loading...

Share This Page