public ActionResult Login(LoginModel model, string returnUrl) { if (ConfigurationWrapper.BooleanSettigs(ConfigKey.UseBetaLogin)) { return(LoadDefaultView()); } var userInfo = _objIAdminOperations.ValidateUser(model.UserName, model.Password); if (ModelState.IsValid && userInfo != null) { FormsAuthentication.SetAuthCookie(model.UserName, true); Session["UserInfo"] = userInfo; return(LoadDefaultView()); } // If we got this far, something failed, redisplay form ModelState.AddModelError("", "The user name or password provided is incorrect."); return(View(model)); }