Cannot modify cookies after HTTP headers have been sent

Discussion in 'ASP .Net' started by gibble@gmail.com, May 10, 2007.

  1. Guest

    Hi,

    I am going crazy. We get a hundred or so of these errors each day and
    while the fix would seem obvious, the error does not include a line
    number!

    --------------------
    Process information:
    Process ID: 10084
    Process name: w3wp.exe

    Exception information:
    Exception type: HttpException
    Exception message: Server cannot modify cookies after HTTP headers
    have been sent.

    Request information:
    Is authenticated: True
    Authentication Type: Forms

    Thread information:
    Thread ID: 15
    Is impersonating: False
    Stack trace: at System.Web.HttpCookieCollection.Add(HttpCookie
    cookie)
    at
    System.Web.Security.FormsAuthenticationModule.OnAuthenticate(FormsAuthenticationEventArgs
    e)
    at System.Web.Security.FormsAuthenticationModule.OnEnter(Object
    source, EventArgs eventArgs)
    at
    System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
    at System.Web.HttpApplication.ExecuteStep(IExecutionStep step,
    Boolean& completedSynchronously)
    --------------------


    According to the logs, it doesn't matter what browser they are using,
    we've had errors from FF, IE6 and IE7, (and AOL users with each of
    those browsers as well) The only common thing is if I scanned the
    errors properly, they all use XP (NT 5.1) ...but that's not too
    surprising.

    Any ideas would be EXCELLENT as some users are having issues logging
    into the site and I believe these errors to be the culprit.

    Thankyou.
     
    , May 10, 2007
    #1
    1. Advertising

  2. bruce barker Guest

    the cookie is a header, so asp.net raises an error if you change it
    after the headers have been sent (as it will have no effect). you have a
    page with buffering turned off.

    -- bruce (sqlwork.com)

    wrote:
    > Hi,
    >
    > I am going crazy. We get a hundred or so of these errors each day and
    > while the fix would seem obvious, the error does not include a line
    > number!
    >
    > --------------------
    > Process information:
    > Process ID: 10084
    > Process name: w3wp.exe
    >
    > Exception information:
    > Exception type: HttpException
    > Exception message: Server cannot modify cookies after HTTP headers
    > have been sent.
    >
    > Request information:
    > Is authenticated: True
    > Authentication Type: Forms
    >
    > Thread information:
    > Thread ID: 15
    > Is impersonating: False
    > Stack trace: at System.Web.HttpCookieCollection.Add(HttpCookie
    > cookie)
    > at
    > System.Web.Security.FormsAuthenticationModule.OnAuthenticate(FormsAuthenticationEventArgs
    > e)
    > at System.Web.Security.FormsAuthenticationModule.OnEnter(Object
    > source, EventArgs eventArgs)
    > at
    > System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
    > at System.Web.HttpApplication.ExecuteStep(IExecutionStep step,
    > Boolean& completedSynchronously)
    > --------------------
    >
    >
    > According to the logs, it doesn't matter what browser they are using,
    > we've had errors from FF, IE6 and IE7, (and AOL users with each of
    > those browsers as well) The only common thing is if I scanned the
    > errors properly, they all use XP (NT 5.1) ...but that's not too
    > surprising.
    >
    > Any ideas would be EXCELLENT as some users are having issues logging
    > into the site and I believe these errors to be the culprit.
    >
    > Thankyou.
    >
     
    bruce barker, May 10, 2007
    #2
    1. Advertising

  3. Gibble Guest

    I actually believe this issue was resolved by renaming the forms
    authentication name in the web.config. I believe during the update
    from 1.1 to 2.0 the cookie encryption changed, and since the old
    cookie was unable to be read, it couldn't be cleared and recreated the
    2.0 way...this renaming seems to have solved the error.

    Thankyou though.

    On May 10, 10:59 am, bruce barker <> wrote:
    > the cookie is a header, so asp.net raises an error if you change it
    > after the headers have been sent (as it will have no effect). you have a
    > page with buffering turned off.
    >
    > -- bruce (sqlwork.com)
    >
    > wrote:
    > > Hi,

    >
    > > I am going crazy. We get a hundred or so of these errors each day and
    > > while the fix would seem obvious, the error does not include a line
    > > number!

    >
    > > --------------------
    > > Process information:
    > > Process ID: 10084
    > > Process name: w3wp.exe

    >
    > > Exception information:
    > > Exception type: HttpException
    > > Exception message: Server cannot modify cookies after HTTP headers
    > > have been sent.

    >
    > > Request information:
    > > Is authenticated: True
    > > Authentication Type: Forms

    >
    > > Thread information:
    > > Thread ID: 15
    > > Is impersonating: False
    > > Stack trace: at System.Web.HttpCookieCollection.Add(HttpCookie
    > > cookie)
    > > at
    > > System.Web.Security.FormsAuthenticationModule.OnAuthenticate(FormsAuthenticationEventArgs
    > > e)
    > > at System.Web.Security.FormsAuthenticationModule.OnEnter(Object
    > > source, EventArgs eventArgs)
    > > at
    > > System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
    > > at System.Web.HttpApplication.ExecuteStep(IExecutionStep step,
    > > Boolean& completedSynchronously)
    > > --------------------

    >
    > > According to the logs, it doesn't matter what browser they are using,
    > > we've had errors from FF, IE6 and IE7, (and AOL users with each of
    > > those browsers as well) The only common thing is if I scanned the
    > > errors properly, they all use XP (NT 5.1) ...but that's not too
    > > surprising.

    >
    > > Any ideas would be EXCELLENT as some users are having issues logging
    > > into the site and I believe these errors to be the culprit.

    >
    > > Thankyou.
     
    Gibble, May 10, 2007
    #3
  4. Gibble Guest

    Apparently, it stopped some of the errors...the once that I got by
    email. But some users are still experiencing the problem and the
    error shows up in their browser...not caught by our error handling for
    some reason.

    The one thing I've noticed from the user who intermittently
    experiences the error here is that it only happens when clicking on a
    link to the site from an email.

    On May 10, 11:50 am, Gibble <> wrote:
    > I actually believe this issue was resolved by renaming the forms
    > authentication name in the web.config. I believe during the update
    > from 1.1 to 2.0 the cookie encryption changed, and since the old
    > cookie was unable to be read, it couldn't be cleared and recreated the
    > 2.0 way...this renaming seems to have solved the error.
    >
    > Thankyou though.
    >
    > On May 10, 10:59 am, bruce barker <> wrote:
    >
    > > the cookie is a header, so asp.net raises an error if you change it
    > > after the headers have been sent (as it will have no effect). you have a
    > > page with buffering turned off.

    >
    > > -- bruce (sqlwork.com)

    >
    > > wrote:
    > > > Hi,

    >
    > > > I am going crazy. We get a hundred or so of these errors each day and
    > > > while the fix would seem obvious, the error does not include a line
    > > > number!

    >
    > > > --------------------
    > > > Process information:
    > > > Process ID: 10084
    > > > Process name: w3wp.exe

    >
    > > > Exception information:
    > > > Exception type: HttpException
    > > > Exception message: Server cannot modify cookies after HTTP headers
    > > > have been sent.

    >
    > > > Request information:
    > > > Is authenticated: True
    > > > Authentication Type: Forms

    >
    > > > Thread information:
    > > > Thread ID: 15
    > > > Is impersonating: False
    > > > Stack trace: at System.Web.HttpCookieCollection.Add(HttpCookie
    > > > cookie)
    > > > at
    > > > System.Web.Security.FormsAuthenticationModule.OnAuthenticate(FormsAuthenticationEventArgs
    > > > e)
    > > > at System.Web.Security.FormsAuthenticationModule.OnEnter(Object
    > > > source, EventArgs eventArgs)
    > > > at
    > > > System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
    > > > at System.Web.HttpApplication.ExecuteStep(IExecutionStep step,
    > > > Boolean& completedSynchronously)
    > > > --------------------

    >
    > > > According to the logs, it doesn't matter what browser they are using,
    > > > we've had errors from FF, IE6 and IE7, (and AOL users with each of
    > > > those browsers as well) The only common thing is if I scanned the
    > > > errors properly, they all use XP (NT 5.1) ...but that's not too
    > > > surprising.

    >
    > > > Any ideas would be EXCELLENT as some users are having issues logging
    > > > into the site and I believe these errors to be the culprit.

    >
    > > > Thankyou.
     
    Gibble, May 10, 2007
    #4
  5. Gibble Guest

    I stand corrected, I still get errors in my email...just not as many
    it seems.

    I thought I read somewhere, that it could be something to do with the
    session timeout vs the forms authentication cookie timeout?

    On May 10, 12:58 pm, Gibble <> wrote:
    > Apparently, it stopped some of the errors...the once that I got by
    > email. But some users are still experiencing the problem and the
    > error shows up in their browser...not caught by our error handling for
    > some reason.
    >
    > The one thing I've noticed from the user who intermittently
    > experiences the error here is that it only happens when clicking on a
    > link to the site from an email.
    >
    > On May 10, 11:50 am, Gibble <> wrote:
    >
    > > I actually believe this issue was resolved by renaming the forms
    > > authentication name in the web.config. I believe during the update
    > > from 1.1 to 2.0 the cookie encryption changed, and since the old
    > > cookie was unable to be read, it couldn't be cleared and recreated the
    > > 2.0 way...this renaming seems to have solved the error.

    >
    > > Thankyou though.

    >
    > > On May 10, 10:59 am, bruce barker <> wrote:

    >
    > > > the cookie is a header, so asp.net raises an error if you change it
    > > > after the headers have been sent (as it will have no effect). you have a
    > > > page with buffering turned off.

    >
    > > > -- bruce (sqlwork.com)

    >
    > > > wrote:
    > > > > Hi,

    >
    > > > > I am going crazy. We get a hundred or so of these errors each day and
    > > > > while the fix would seem obvious, the error does not include a line
    > > > > number!

    >
    > > > > --------------------
    > > > > Process information:
    > > > > Process ID: 10084
    > > > > Process name: w3wp.exe

    >
    > > > > Exception information:
    > > > > Exception type: HttpException
    > > > > Exception message: Server cannot modify cookies after HTTP headers
    > > > > have been sent.

    >
    > > > > Request information:
    > > > > Is authenticated: True
    > > > > Authentication Type: Forms

    >
    > > > > Thread information:
    > > > > Thread ID: 15
    > > > > Is impersonating: False
    > > > > Stack trace: at System.Web.HttpCookieCollection.Add(HttpCookie
    > > > > cookie)
    > > > > at
    > > > > System.Web.Security.FormsAuthenticationModule.OnAuthenticate(FormsAuthenticationEventArgs
    > > > > e)
    > > > > at System.Web.Security.FormsAuthenticationModule.OnEnter(Object
    > > > > source, EventArgs eventArgs)
    > > > > at
    > > > > System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
    > > > > at System.Web.HttpApplication.ExecuteStep(IExecutionStep step,
    > > > > Boolean& completedSynchronously)
    > > > > --------------------

    >
    > > > > According to the logs, it doesn't matter what browser they are using,
    > > > > we've had errors from FF, IE6 and IE7, (and AOL users with each of
    > > > > those browsers as well) The only common thing is if I scanned the
    > > > > errors properly, they all use XP (NT 5.1) ...but that's not too
    > > > > surprising.

    >
    > > > > Any ideas would be EXCELLENT as some users are having issues logging
    > > > > into the site and I believe these errors to be the culprit.

    >
    > > > > Thankyou.
     
    Gibble, May 10, 2007
    #5
    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. =?Utf-8?B?Y2hzYWtkYQ==?=
    Replies:
    1
    Views:
    784
    Peter Rilling
    Apr 23, 2004
  2. Andreas Klemt
    Replies:
    8
    Views:
    10,718
    spalding
    Aug 17, 2004
  3. Andreas Klemt
    Replies:
    7
    Views:
    20,407
    Byock
    Nov 27, 2006
  4. Replies:
    0
    Views:
    3,306
  5. Ian
    Replies:
    2
    Views:
    2,030
Loading...

Share This Page