ASP.NET MVC Session.IsNewSession issue with Google Chrome

前端 未结 2 2044
悲哀的现实
悲哀的现实 2021-01-02 13:32

I\'m currently working on a Session expired piece of logic for my ASP.NET 3.5 MVC 2 project to log out a user and redirect them to the AccountController LogOn action.

<
2条回答
  •  耶瑟儿~
    2021-01-02 14:22

    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;
    }
    

提交回复
热议问题