当Session_End中()在ASP.NET MVC叫什么名字? [英] When is Session_End() called in ASP.NET MVC?
问题描述
我已经配置我的的Web.Config
文件遵循一个ASP.NET MVC 2项目:
I have configured my Web.Config
file as follow in a ASP.NET MVC 2 project:
<sessionState mode="InProc" timeout="1"/>
和加入的Global.asax.cs
以下内容:
protected void Session_End(object sender, EventArgs e)
{
System.Diagnostics.Debug.WriteLine("Session_End");
}
protected void Session_Start(object sender, EventArgs e)
{
System.Diagnostics.Debug.WriteLine("Session_Start");
}
当一个新的用户进入网站
在session_start()
被调用。我本来期望 Session_End中()
1分钟后的空闲时间被调用,但它并非如此。我缺少的东西吗?
Session_Start()
is called when a new user goes on the website. I would have expected Session_End()
to be called after 1 minute of idle time, but it's not the case. Am I missing something?
推荐答案
要有耐心。该事件应该叫,但超时后不一定对。
Be patient. The event should be called, but not necessarily right after the timeout.
您可以尝试从浏览器:启动一个会话,等待> 1分钟,做一回发莫名其妙
You could try from a Browser: Start a session,wait > 1 minute, do a Postback somehow
这应有助于验证超时工作,我想你也会看到SESSIONEND发生在那个时候。否则,就等着开始一些其他的会议。系统会来到身边Ø调用它的某个时候。
This should help to verify that the Timeout works and I think you will also see the SessionEnd happening at that time. Otherwise, just wait and start some other sessions. The system will come around o calling it sometime.
这篇关于当Session_End中()在ASP.NET MVC叫什么名字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!