thebeebs | FIX: Session state has created a session id, but cannot save it because the response was already flushed by the application.
thebeebs
Learn the art of website security
 
 

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

by thebeebs 18. October 2009 05:35

The session Id is written to a cookie only when Session.SessionId is called, in my current project we don’t use many sessions in the application but they are used by some partial views to pass data around.

Because Session.SessionId is not called before the page is flushed, when the view decides that it needs to save some session information after the page has flushed, it’s too late for the application to write the SessionId to the users cookie collection and so the above error is thrown.

To fix the issue I have ensured that we call Session.SessionID before the page has been flushed by adding the following code into the session start:

 

SessionStart

 

This should fix the issue.

Tags:

Comments (2) -

stratford on avon hotels
stratford on avon hotels United States
9/6/2011 12:22:57 AM #

Hey this is a great post. Could you keep me updated with any other info similar to this? If travelling to the UK why not stay at Stratford hotel and watch a Shakespear play

Gregory Despain
Gregory Despain United States
10/14/2011 10:19:59 AM #

The new Zune browser is surprisingly good, but not as good as the iPod's. It works well, but isn't as fast as Safari, and has a clunkier interface. If you occasionally plan on using the web browser that's not an issue, but if you're planning to browse the web alot from your PMP then the iPod's larger screen and better browser may be important.

Comments are closed