public JsonResult SignIn([FromBody] SignInModel model) { try { var principal = new UserPrincipal(model.UserName, _accountRepository); if (principal.AuthenticatePassword(model.Password)) { FormsAuthentication.SetAuthCookie(principal.User.LoginName, false); return(Json(true)); } return(Json(false)); } catch (DataNotFoundException dnfex) { var message = string.Format("Login attempt from IP {0} with usernam {1} and password {2} : Exception - {3}", Request.ServerVariables["REMOTE_ADDR"], model.UserName, model.Password, Logger.GetExceptionMessage(dnfex, "SignIn")); Logger.LogMessage(EventLogType.Warning, "SignIn", message, 0); return(Json(false)); } }