public ActionResult Login(LoginModel model, string returnUrl) { if (ModelState.IsValid && (model.Email=="*****@*****.**" && model.Password=="login123")) { FormsAuthentication.SetAuthCookie(model.Email, false); return RedirectToLocal(returnUrl); } // If we got this far, something failed, redisplay form ModelState.AddModelError("", "The user name or password provided is incorrect."); return View(model); }
public ActionResult Auth(LoginModel model) { if ((ModelState.IsValid) && (MvcApplication.registeredUsers.FirstOrDefault(x => x.Email == model.Email && x.Password == model.Password) != null)) { FormsAuthentication.SetAuthCookie(model.Email, false); return RedirectToAction("AuthorizeExternalAccess"); } // If we got this far, something failed, redisplay form ModelState.AddModelError("", "The user name or password provided is incorrect."); return View(model); }