且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ASP.NET MVC Session.IsNewSession问题与谷歌浏览

更新时间:2023-02-01 19:04:32

ASP.NET会为每个请求创建一个新的会话,除非你存储在它的东西。
试着增加code以下到你的的Global.asax 。它工作在我的MVC2和MVC3应用程序具有相同 SessionExpireFilterAttribute

ASP.NET will create a new session for every request unless you store something in it. Try adding the code below to your Global.asax. It works in my MVC2 and MVC3 apps with the same SessionExpireFilterAttribute.

protected void Session_Start()
{
    Session["Dummy"] = 1;
}