在我的MVC 3应用程序,我有一个非常基本的控制器FormsAuthentication.SetAuthCookie问题
[HttpPost]
public ActionResult SignIn(LogonModel logonModel)
{
string logonMessage;
if(_authenticationService.Login(logonModel.UserName, logonModel.Password,
out logonMessage))
{
FormsAuthentication.SetAuthCookie(logonModel.UserName,true);
return RedirectToAction("Index", "Home");
}
return View();
}
我看到cookie的浏览器越来越设置但是当我关闭浏览器,然后回来到现场,这是不自动登录我。这几乎就像cookie没有被处理,它应该是。
我将此标记为答案,因为它得到我回头看着web.config。我在Cookie中有一个错字。现在它似乎工作。我还没有测试过所有的浏览器,但它在Chrome中起作用。非常感谢......我爱错别字。 – 2011-04-18 16:45:09
嘿嘿,我可以“帮助”:) – 2011-04-18 17:31:17
有趣的是,我如何回顾这些,并意识到我今天有多好的开发人员......我永远不会问这个今天迟钝的东西:) – 2012-05-08 21:29:31