会话在CTRL + F5上过期

时间:2015-10-05 12:56:18

标签: c# asp.net-mvc session

我使用的是会员资格,登录代码如下:

public ActionResult Login(LoginModel model, string returnUrl)
    {
        bool b = Membership.ValidateUser(model.UserName, model.Password);
        try
        {
            if (ModelState.IsValid && Membership.ValidateUser(model.UserName, model.Password))
            {
                Session["Role"] = Roles.GetRolesForUser(model.UserName)[0];
                Session["UserName"] = true;
                FormsAuthentication.SetAuthCookie(model.UserName, true);
                return RedirectToAction("TransHome", "Transcription");
            }
            else
                ViewBag.errmsg = "The user name or password is incorrect.";
            return View(model);
        }

每次点击CTRL + F5会话都已过期。有什么解决方案吗?

0 个答案:

没有答案