首页 新闻 会员 周边 捐助

网站出现:Session state has created a session id, but cannot save it because the response was alread

0
悬赏园豆:50 [已解决问题] 解决于 2012-07-17 11:37

bm网上传至服务器后出现如下:

但刷新后又正常了。求高手给解决,谢谢

问题补充:我用到了NVelocity做模板,这个以前没有用过,不清楚是不是这个问题

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) +3624169
   System.Web.SessionState.SessionStateModule.DelayedGetSessionId() +199
   System.Web.SessionState.SessionStateModule.ReleaseStateGetSessionID() +25
   System.Web.SessionState.SessionStateModule.OnReleaseState(Object source, EventArgs eventArgs) +874
   System.Web.SessionState.SessionStateModule.OnEndRequest(Object source, EventArgs eventArgs) +208
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +266
 


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1 
网络农民的主页 网络农民 | 初学一级 | 园豆:63
提问于:2012-07-16 10:17
< >
分享
最佳答案
0

取消一个地方的:Response.Flush(); 问题没有再出现。。。。。。

网络农民 | 初学一级 |园豆:63 | 2012-07-17 11:35
其他回答(3)
0

在网站的global.asax中的Session_Start中添加:

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

试试

参考:http://stackoverflow.com/questions/904952/whats-causing-session-state-has-created-a-session-id-but-cannot-save-it-becau

收获园豆:50
artwl | 园豆:16736 (专家六级) | 2012-07-16 10:26

加过这个,无效。。。。

支持(0) 反对(0) 网络农民 | 园豆:63 (初学一级) | 2012-07-16 10:27
0

在页面中是如何处理Session的?

dudu | 园豆:30778 (高人七级) | 2012-07-16 10:38

只是文章列表,没有用到Session

支持(0) 反对(0) 网络农民 | 园豆:63 (初学一级) | 2012-07-16 10:39

@网络农民: 在web.config中加上

<sessionState mode="Off" />
支持(0) 反对(0) dudu | 园豆:30778 (高人七级) | 2012-07-16 10:46
0

取消一个地方的:Response.Flush(); 问题没有再出现。。。。。。

 

取消什么地方的...Response.Flush();

viky88 | 园豆:202 (菜鸟二级) | 2013-01-13 00:26
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册