November Happy Hour will be moved to Thursday December 5th.

Episerver form authentication based on remember me

Vote:
 

Hi,

i have a custom login page.I want load the login credentials if the user is clicked on remember me other wise if the user opens the browser for next time it should redirect to login instead of directly redirecting to home page.episerver login page

#144832
Feb 19, 2016 14:41
Vote:
 

Change the attribute in Web config from util/login.aspx to your custom login page. Implement a check box for remember me that stores the cookie for authentication as permanent. It's a bool flag on the formsauthentication class that you should set to true if I remember correctly.

#144834
Feb 19, 2016 14:59
Vote:
 

 [HttpPost]
public ActionResult Login(Models.User user)
{
if (ModelState.IsValid)
{
if (Membership.ValidateUser(user.UserName, user.Password))
{
FormsAuthentication.SetAuthCookie(user.UserName, user.RememberMe);
return RedirectToAction("Index");
}
else
{
ModelState.AddModelError(string.Empty, "Login failed!");
}
}
return View(user);
}

i am using FormsAuthentication in login post action.

Can you please explain your thought more briefly.

#144838
Feb 19, 2016 15:24
Vote:
 

With that I think all you need is change login url in Web.config. Search for /util/login.aspx and replace with url to your login page. Episerver will take care of the rest for redirects...

#144844
Feb 19, 2016 16:16
Vote:
 

Thanks a lot i got it working

#144885
Edited, Feb 22, 2016 7:43
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.