public ActionResult Login(FormCollection values, string returnUrl) { var userCode = values["userName"]; var password = values["password"]; var rememberMe = values["rememberMe"] == "on" ? true : false; var userSvc = new UserLogic(Ticket); userSvc.Authenticate(userCode, password); if (!userSvc.Authenticate(userCode, password)) { DisplayError(userSvc.ErrorMessage); ViewData.Add("returnUrl", returnUrl); ViewData.Add("userName", userCode); return View(); } if (rememberMe) { var defaultCookie = new HttpCookie("defaultCredentials", userCode); defaultCookie.Expires = DateTime.Now.AddMonths(1); HttpContext.Response.Cookies.Add(defaultCookie); } if (string.IsNullOrEmpty(returnUrl)) { return Redirect("~/"); } else { return Redirect(returnUrl); } }