Cannot modify cookies after HTTP headers have been sent

G

gibble

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.
 
B

bruce barker

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)
 
G

Gibble

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.
 
G

Gibble

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.
 
G

Gibble

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?
 

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,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top