public JsonResult Login(LoginModel login) { _securityDataProvider = new SecurityDataProvider(); ServiceResponse response = _securityDataProvider.CheckLogin(login, false); if (response.IsSuccess) { if (login.IsRemember) { FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, login.Email, DateTime.Now, DateTime.Now.AddMinutes( ConfigSettings .RememberMeDuration), true, login.Email, FormsAuthentication.FormsCookiePath); // Encrypt the ticket. string encTicket = FormsAuthentication.Encrypt(ticket); // Create the cookie. HttpCookie httpCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encTicket) { Expires = ticket.Expiration }; Response.Cookies.Add(httpCookie); } else { FormsAuthentication.SetAuthCookie(login.Email, false); } SessionValueData sessionValue = (SessionValueData)response.Data; SessionHelper.UserID = sessionValue.UserID; SessionHelper.Name = sessionValue.Name; SessionHelper.FirstName = sessionValue.FirstName; SessionHelper.Roles = sessionValue.Roles; SessionHelper.SelectedRole = sessionValue.SelectedRole; } return Json(response); }