Question

sujith sb on Thu, 05 May 2011 09:38:25


Dear All,

I am using wss3.0. In my site randomly shows the following error page during the loggin time. All other times it works fine.

Server Error in '/' Application.

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

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Session state has created a session id, but cannot save it because the response was already flushed by the application.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:

[HttpException (0x80004005): Session state has created a session id, but cannot save it because the response was already flushed by the application.]
System.Web.SessionState.SessionIDManager.SaveSessionID(HttpContext context, String id, Boolean& redirected, Boolean& cookieAdded) +8557557
System.Web.SessionState.SessionStateModule.CreateSessionId() +57
System.Web.SessionState.SessionStateModule.DelayedGetSessionId() +64
System.Web.SessionState.SessionStateModule.ReleaseStateGetSessionID() +20
System.Web.SessionState.SessionStateModule.OnReleaseState(Object source, EventArgs eventArgs) +536
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +68
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75



Version Information: Microsoft .NET Framework Version:2.0.50727.3615; ASP.NET Version:2.0.50727.3618

 

This error will be disappears on the temporary file clearing. This error will be occurs randomly. So i can't simulate this issue in any test case.

 

Please help me.

 

Thanks in advance..

 

Replies

Tom Molskow on Thu, 05 May 2011 18:19:03


Hello,

Check for a global.asax file in IIS - see this article for more information:

http://msdn.microsoft.com/en-us/library/1xaas8a2(v=vs.71).aspx

If it is there add this code:

void Session_Start(object sender, EventArgs e)  
{ 
   
// Code that runs when a new session is started 
   
string sessionId = Session.SessionID; 
} 

That should fix it!

Thanks!

Tom

 

 

 

John Halliday2 on Mon, 04 Jan 2016 16:36:57


Tom, this fixed it for me!  Thank you.

What perplexes me is why this isn't entered by default when VS 2013 creates a blank web app. with a Global.asax file.  You would think it would be there by default.

Anyway, easy fix and thanks again.

JHH