I have a standard ASP.NET MVC (RC Refresh) web project, with the standard ASP.NET Membership provider and the Account controller that is included in the project template.
When I check "Remember me" in my Login form, I am still not being remembered by the site. (Firefox remembers my username and password, but what I expected to happen was to be automatically logged on).
Do I have to set and check the cookie manually? If so, how should it best be done?
You need to pass true/false to the SetAuthCookie method.
public ActionResult Login (string email, string password, bool rememberMe, string returnUrl)
{
// snip
FormsAuth.SetAuthCookie(username, rememberMe); // <- true/false
// snip
}
and make sure that bool rememberMe
reflects the status of the checkbox on your login page.