title: MVC4 Show model state Error Message on Homepage Login
body: <p>I have a login form on my homepage.  It works - but I want to display an error message if the pw is wrong.  My code is below.  How do I return to the same page but retrieve the modelstate error in the Index method? </p>
  
  <pre><code>[HttpPost]
          [AllowAnonymous]
          [ValidateAntiForgeryToken]
          public ActionResult HomeLogin(LoginModel model, string returnUrl)
          {
              if (ModelState.IsValid &amp;&amp; WebSecurity.Login(model.UserName, model.Password, persistCookie: model.RememberMe))
              {
                  return RedirectToLocal(returnUrl);
              }
  
              // If we got this far, something failed, redisplay form
              ModelState.AddModelError("", "The user name or password provided is incorrect.");
              return RedirectToAction("Index");
  
          }
  </code></pre>