本文介绍了ASP.Net在session_start总是射击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有点困惑如下:
我建立了一个asp.net网站,将在在session_start()的Global.asx的一些逻辑。我预计,这甚至将只在会话期间触发一次。然而,触发的事件与每一个请求。

I am a bit confused about the following:I set up an asp.net Website with some logic in the Session_Start() of the Global.asx. I expected that this even will only trigger once during a session. However the event fired with every single request.

当我宣布一个虚拟会话对象这个固定的问题。
的sessionState模式=是InProc/>此外,当我加入&LT,我可以解决这个问题在web.config中。我用IIS7和我检查了默认值,这个值已经设置为进行中。

When I declare a dummy session object this fixed the problem. Also I can fix this problem when I add <sessionState mode="InProc" /> in the web.config. I use IIS7 and I checked the default value and this is already set to "In Process".

我失去了一些东西?这是正常的行为呢?我期待该事件,即使我不申报会话对象工作。

I am missing something? Is this normal behaviour? I was expecting this event to work even if I don't declare a session object.

推荐答案

您最好检查:


  • 已启用了Web浏览器的cookies?

  • 如果您希望浏览器cookie被禁用,则需要cookie的会话状态管理(这是不是一个好的选择,因为会话参数将在查询字符串...)。

  • 中的Application_Start在Global.asx过程中,如果你做的东西在那里,你检查是不是抛出一些异常,使你的应用程序崩溃和结束?

  • 在的Application_Start之后的任何阶段,而在session_start之前,你在做什么?如果您遇到这种情况,请检查同样的事情previous点。

这篇关于ASP.Net在session_start总是射击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 21:35