title: ModelState.AddModelError not displaying error in view - ASP.NET
body: <p>I have been banging my head against the wall trying to solve this issue.</p>
  
  <p>I have this view controller</p>
  
  <pre><code>public class LoginController : Controller
      {
          public ActionResult Index(LoginClass model)
          {
              return View(model);
          }
  
          [HttpPost]
          public ActionResult Login(LoginClass model, string ReturnUrl)
          {
  
              if (!this.ModelState.IsValid)
              {
                  return this.View(model);
              }
  
              if (ModelState.IsValid)
              {
                  if (Membership.ValidateUser(model.UserName, model.Password))
                  {
                      FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe);
                      if (Url.IsLocalUrl(ReturnUrl) &amp;&amp; ReturnUrl.Length &gt; 1 &amp;&amp; ReturnUrl.StartsWith("/")
                          &amp;&amp; !ReturnUrl.StartsWith("//") &amp;&amp; !ReturnUrl.StartsWith("/\\"))
                      {
                         return Redirect(ReturnUrl);
                      }
                      else
                      {
                          return RedirectToAction("Index", "Home");
                      }
                  }
                  else
                  {
                      ModelState.AddModelError(string.Empty, "The user name or password provided is incorrect");
                  }
  
  
              }
  
              return RedirectToAction("Index", "Login", model);
  
          }
  
          public ActionResult Logout()
          {
              FormsAuthentication.SignOut();
  
              return RedirectToAction("Index", "Home");
          }
  
      }
  </code></pre>
  
  <p>and here is my view:</p>
  
  <pre><code>&lt;section id="login"&gt;
      &lt;div class="container"&gt;
          &lt;form action="~/Login/Login" id="Login" method="post"&gt;
              &lt;div class="row"&gt;
                  &lt;div class="col-md-12"&gt;
                      &lt;p&gt;
                          &lt;label for="username"&gt;Username&lt;/label&gt;
                          &lt;input type="text" id="username" name="username" class="form-control" /&gt;
                      &lt;/p&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="row"&gt;
                  &lt;div class="col-md-12"&gt;
                      &lt;p&gt;
                          &lt;label for="password"&gt;Password&lt;/label&gt;
                          &lt;input type="password" id="password" name="password" class="form-control" /&gt;
                      &lt;/p&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="row"&gt;
                  &lt;div class="col-md-12"&gt;
                      &lt;p&gt;
                          &lt;input type="submit" id="submit" name="submit" value="Login" class="btn btn-default" /&gt;
                      &lt;/p&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="row"&gt;
                  &lt;div class="col-md-12"&gt;
                      &lt;p&gt;
                          &lt;label for="password"&gt;Remember Me?&lt;/label&gt;
                          &lt;input type="checkbox" id="chkPersist" name="chkPersist" /&gt;
                      &lt;/p&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="row"&gt;
                  &lt;div class="col-md-12"&gt;
                      &lt;p&gt;
                          @Html.ValidationSummary()
                      &lt;/p&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/form&gt;
      &lt;/div&gt;
  &lt;/section&gt;
  </code></pre>
  
  <p>My issue is that my error message is not appearing when I enter the wrong username and password. Why is not displaying?</p>