//[HandleErrorAction("OnIndexError")] public ActionResult Index(LoginInfo loginInfo) { if (string.Compare(loginInfo.UserName, "foo", true) != 0) { throw new InvalidUserNameException(); } if (loginInfo.Password != "password") { throw new InvalidPasswordException(); } return View(loginInfo); }
public string Index(LoginInfo loginInfo) { string pwd; if (userAcccounts.TryGetValue(loginInfo.UserName, out pwd)) { if (loginInfo.Password != pwd) { throw new InvalidPasswordException(); } return "认证成功"; } throw new InvalidUserNameException(); }
public ActionResult OnIndexError(LoginInfo loginInfo) { return View(loginInfo); }