public ActionResult LogOn(AuthorizationModel model) { //if (authenticationService.IsValid(model.Login, model.Password)) // валидируем пользователя { FormsAuthentication.SetAuthCookie(model.Login, true); // выставляем куки для авторизованных лиц if (!String.IsNullOrEmpty(model.ReturnUrl)) { return Redirect(model.ReturnUrl); } return RedirectToAction("Index", "Home"); } ModelState.AddModelError("", "Неверное имя пользователя или пароль"); return View(model); }
public ActionResult LogOnPartial(AuthorizationModel model = null) { if (User.Identity.IsAuthenticated) { return PartialView("PartialUserInfo", new PartialUserInfo { Name = User.Identity.Name }); } return PartialView(model ?? new AuthorizationModel()); }