title: Don't Show Validation Summary Message First Time MVC
body: <p>I am using MVC Identity For login and MVC Validation For Required Fields, I don't want to show error messages first time. It should be shown only when user click submit button. But as page is getting post to ActionResult every time, So it is showing me validation as well.
  What is a way to not show messages first time on page load.
  I have used this code to clear messages, but it clear every time</p>
  
  <p><img src="https://i.stack.imgur.com/y5XzF.png" alt="enter image description here"> </p>
  
  <pre><code>public ActionResult Login(LoginModel model)
  {
  if (!ModelState.IsValid)
  {
         return View("Login");
  }
  foreach (var key in ModelState.Keys)
  {
     ModelState[key].Errors.Clear();
  }
  }
  //Model
   public class LoginModel
  {
  
      [Required]
      [DataType(DataType.EmailAddress)]
      [Display(Name = "Email")]
      public string Email { get; set; }
  
      [Required]
      [DataType(DataType.Password)]
      [Display(Name = "Password")]
      public string Password { get; set; }
     }
  
    //HTML
    @using (Html.BeginForm())
      {
          @Html.ValidationSummary("")
          @Html.TextBoxFor(model =&gt; model.Email, new { maxlength = "45", placeholder = "User Email" })
          @Html.PasswordFor(model =&gt; model.Password, new { maxlength = "45", placeholder = "User Password" })
          &lt;button type="submit" class="LoginBtn" id="loginButton"&gt;&lt;/button&gt;
     }
  </code></pre>