我使用的是会员资格,登录代码如下:
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会话都已过期。有什么解决方案吗?