This error appears if:
Application launch
You use Global.asax even if you do something in Session_Start / End events or not
Your app makes flush response too fast
You do not use a session before flush
It arises from session state when it tries to save sessionID on release:
System.Web.SessionState.SessionIDManager.SaveSessionID(HttpContext context, String id, Boolean& redirected, Boolean& cookieAdded) System.Web.SessionState.SessionStateModule.CreateSessionId() System.Web.SessionState.SessionStateModule.DelayedGetSessionId() System.Web.SessionState.SessionStateModule.ReleaseStateGetSessionID() System.Web.SessionState.SessionStateModule.OnReleaseState(Object source, EventArgs eventArgs) System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
I believe that having Global.asax forces the session identifier to be saved when the SessionStateModule is released (late?), Even if no session was used for the HttpSessionState when calling SessionID.
This is the reason string sessionId = Session.SessionID; avoids the problem.
I assume that it appears only when the application starts because of initialization behavior.
Solutions / Tricks :
Avoid flushing in Page_Load, as already mentioned
Deactivate session state on page (EnableSessionState)
Use SessionID trick before flush
Use Response.End () instead of .Flush () if you don't care about errors that may occur after your flash
JoeBilly Mar 16 '10 at 12:02 2010-03-16 12:02
source share