title: Model items are empty
body: <p>I am working on ASP.NET Core 3.1. Using EF, I have added my table models. Right now I am trying to implement login / register functionality. For this, I have an <code>AccountController</code> and inside that, I have created a <code>Task</code></p>
  <pre><code>[HttpPost]
  public async Task&lt;ActionResult&gt; Registar(RegistrationViewModel model)
  {
          if (ModelState.IsValid)
          {
              TblUser user = new TblUser
              {
                  Username = model.Username,
                  FirstName = model.FirstName,
                  LastName = model.LastName,
                  Gender = model.Gender,
                  City = model.City,
                  Address = model.Address,
                  PhoneNumber = model.PhoneNumber,
                  Email = model.Email,
                  Password = model.Password,
                  PasswordHash = BC.HashPassword(model.Password),
                  AuthKey = &quot;a&quot; + MD5.Create(model.Email),
                  CreatedAt = DateTime.Now.ToString(&quot;yyyy-MM-dd h:mm:ss&quot;)
              };
              _context.Add(user);
              await _context.SaveChangesAsync();
          }
          else
          {
              return View(&quot;Registration&quot;);
          }
  
          return RedirectToAction(&quot;Index&quot;, &quot;Account&quot;);
  }
  
  // registration Page load
  public IActionResult Registration()
  {
      ViewData[&quot;Message&quot;] = &quot;Registration Page&quot;;
      return View();
  }
  </code></pre>
  <p>Registration view model:</p>
  <pre><code>public class RegistrationViewModel
  {
      [Required]
      [StringLength(15, MinimumLength = 3)]
      public string Username { get; set; }
  
      [Required]
      [StringLength(15, MinimumLength = 3)]
      public string FirstName { get; set; }
  
      [Required]
      [StringLength(15, MinimumLength = 3)]
      public string LastName { get; set; }
  
      [Required]
      [StringLength(15, MinimumLength = 3)]
      public string Gender { get; set; }
  
      [Required]
      [StringLength(150, MinimumLength = 3)]
      public string Address { get; set; }
  
      [Required]
      [StringLength(15, MinimumLength = 3)]
      public string City { get; set; }
  
      [Required]
      [RegularExpression(@&quot;^(\d{10})$&quot;, ErrorMessage = &quot;Mobile no not valid&quot;)]
      public string PhoneNumber { get; set; }
  
      [Required]
      [EmailAddress]
      public string Email { get; set; }
  
      [Required]
      [StringLength(10, MinimumLength = 6)]
      public string Password { get; set; }
  
      [Required]
      [NotMapped] // Does not effect with database
      [Compare(&quot;Password&quot;)]
      public string ConfirmPassword { get; set; }
  }
  </code></pre>
  <p><code>Registration.cshtml</code>:</p>
  <pre><code>@model RegistrationViewModel
  @{
  ViewData[&quot;Title&quot;] = &quot;Register&quot;;
  Layout = &quot;~/Views/Shared/_Layout.cshtml&quot;;
  }
  
  &lt;div class=&quot;row&quot;&gt;
  @if (TempData[&quot;validationmessage&quot;] != null)
  {
      string alertType = &quot;alert alert-&quot; + TempData[&quot;alertType&quot;];
      &lt;div class=&quot;@alertType&quot;&gt;
          &lt;strong&gt;Alert!&lt;/strong&gt; @TempData[&quot;validationmessage&quot;]
      &lt;/div&gt;
  }
  &lt;/div&gt;
  &lt;h2 class=&quot;text-center&quot;&gt;Registar&lt;/h2&gt;
  &lt;div class=&quot;row&quot;&gt;
  &lt;div class=&quot;col-md-6 col-md-offset-3&quot;&gt;
      &lt;div class=&quot;jumbotron&quot;&gt;
          &lt;div asp-validation-summary=&quot;ModelOnly&quot; class=&quot;text-danger&quot;&gt;&lt;/div&gt;
          &lt;form role=&quot;form&quot; asp-action=&quot;Registar&quot; asp-controller=&quot;Account&quot; method=&quot;post&quot;&gt;
  
              &lt;div class=&quot;form-group&quot;&gt;
                  &lt;label for=&quot;Name&quot;&gt;User Name&lt;/label&gt;
                  &lt;input type=&quot;text&quot; name=&quot;Username&quot; asp-for=&quot;Username&quot; class=&quot;form-control input-sm&quot; autocomplete=&quot;off&quot; data-val=&quot;true&quot; data-val-required=&quot;The Username field is required.&quot; placeholder=&quot;Username&quot;&gt;
                  &lt;span asp-validation-for=&quot;Username&quot; class=&quot;text-danger&quot;&gt;&lt;/span&gt;
              &lt;/div&gt;
  
              &lt;div class=&quot;form-group&quot;&gt;
                  &lt;label asp-for=&quot;FirstName&quot;&gt;&lt;/label&gt;
                  &lt;input type=&quot;text&quot; name=&quot;FName&quot; data-val=&quot;true&quot; autocomplete=&quot;off&quot; data-val-required=&quot;The FirstName field is required.&quot; asp-for=&quot;FirstName&quot; class=&quot;form-control input-sm&quot; placeholder=&quot;First Name&quot;&gt;
                  &lt;span asp-validation-for=&quot;FirstName&quot; class=&quot;text-danger&quot;&gt;&lt;/span&gt;
              &lt;/div&gt;
  
              &lt;div class=&quot;form-group&quot;&gt;
                  &lt;label asp-for=&quot;LastName&quot;&gt;&lt;/label&gt;
                  &lt;input type=&quot;text&quot; name=&quot;LName&quot; data-val=&quot;true&quot; autocomplete=&quot;off&quot; data-val-required=&quot;The LastName field is required.&quot; asp-for=&quot;LastName&quot; class=&quot;form-control input-sm&quot; placeholder=&quot;Last Name&quot;&gt;
                  &lt;span asp-validation-for=&quot;LastName&quot; class=&quot;text-danger&quot;&gt;&lt;/span&gt;
              &lt;/div&gt;
  
              &lt;div class=&quot;form-group&quot;&gt;
                  &lt;label for=&quot;Email&quot;&gt;Email&lt;/label&gt;
                  &lt;input type=&quot;email&quot; name=&quot;Email&quot; asp-for=&quot;Email&quot; autocomplete=&quot;off&quot; data-val=&quot;true&quot; class=&quot;form-control input-sm&quot; data-val-required=&quot;The Email field is required.&quot; placeholder=&quot;Email Address&quot;&gt;
                  &lt;span asp-validation-for=&quot;Email&quot; class=&quot;text-danger&quot;&gt;&lt;/span&gt;
              &lt;/div&gt;
  
              &lt;div class=&quot;form-group&quot;&gt;
                  &lt;label asp-for=&quot;Gender&quot;&gt;&lt;/label&gt;
                  &lt;input type=&quot;text&quot; name=&quot;gender&quot; data-val=&quot;true&quot; autocomplete=&quot;off&quot; data-val-required=&quot;The Gender field is required.&quot; asp-for=&quot;Gender&quot; class=&quot;form-control input-sm&quot; placeholder=&quot;Gender&quot;&gt;
                  &lt;span asp-validation-for=&quot;Gender&quot; class=&quot;text-danger&quot;&gt;&lt;/span&gt;
              &lt;/div&gt;
  
              &lt;div class=&quot;form-group&quot;&gt;
                  &lt;label asp-for=&quot;PhoneNumber&quot;&gt;&lt;/label&gt;
                  &lt;input type=&quot;number&quot; name=&quot;Number&quot; data-val=&quot;true&quot; autocomplete=&quot;off&quot; data-val-required=&quot;The PhoneNumber field is required.&quot; asp-for=&quot;PhoneNumber&quot; class=&quot;form-control input-sm&quot; placeholder=&quot;Phone Number&quot;&gt;
                  &lt;span asp-validation-for=&quot;PhoneNumber&quot; class=&quot;text-danger&quot;&gt;&lt;/span&gt;
              &lt;/div&gt;
  
              &lt;div class=&quot;form-group&quot;&gt;
                  &lt;label asp-for=&quot;Address&quot;&gt;&lt;/label&gt;
                  &lt;input type=&quot;text&quot; name=&quot;address&quot; data-val=&quot;true&quot; autocomplete=&quot;off&quot; data-val-required=&quot;The Address field is required.&quot; asp-for=&quot;Address&quot; class=&quot;form-control input-sm&quot; placeholder=&quot;Address&quot;&gt;
                  &lt;span asp-validation-for=&quot;Address&quot; class=&quot;text-danger&quot;&gt;&lt;/span&gt;
              &lt;/div&gt;
  
              &lt;div class=&quot;form-group&quot;&gt;
                  &lt;label asp-for=&quot;City&quot;&gt;&lt;/label&gt;
                  &lt;input type=&quot;text&quot; name=&quot;city&quot; data-val=&quot;true&quot; autocomplete=&quot;off&quot; data-val-required=&quot;The City field is required.&quot; asp-for=&quot;City&quot; class=&quot;form-control input-sm&quot; placeholder=&quot;City&quot;&gt;
                  &lt;span asp-validation-for=&quot;City&quot; class=&quot;text-danger&quot;&gt;&lt;/span&gt;
              &lt;/div&gt;
  
              &lt;div class=&quot;form-group&quot;&gt;
                  &lt;label for=&quot;Password&quot;&gt;Password&lt;/label&gt;
                  &lt;input type=&quot;password&quot; name=&quot;Password&quot; asp-for=&quot;Password&quot; autocomplete=&quot;off&quot; class=&quot;form-control input-sm&quot; data-val=&quot;true&quot; data-val-required=&quot;The Password field is required.&quot; placeholder=&quot;Password&quot;&gt;
                  &lt;span asp-validation-for=&quot;Password&quot; class=&quot;text-danger&quot;&gt;&lt;/span&gt;
              &lt;/div&gt;
  
              &lt;div class=&quot;form-group&quot;&gt;
                  &lt;label for=&quot;ConfirmPassword&quot;&gt;Password&lt;/label&gt;
                  &lt;input type=&quot;password&quot; name=&quot;ConfirmPassword&quot; asp-for=&quot;ConfirmPassword&quot; autocomplete=&quot;off&quot; class=&quot;form-control input-sm&quot; placeholder=&quot;ConfirmPassword&quot;&gt;
                  &lt;span asp-validation-for=&quot;ConfirmPassword&quot; class=&quot;text-danger&quot;&gt;&lt;/span&gt;
              &lt;/div&gt;
  
              &lt;input type=&quot;submit&quot; value=&quot;Register&quot; class=&quot;btn btn-info btn-block&quot;&gt;
              &lt;input name=&quot;__RequestVerificationToken&quot; type=&quot;hidden&quot; value=&quot;&lt;removed for brevity&gt;&quot;&gt;
          &lt;/form&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  <p>Now when I am trying to register I am getting below validation errors</p>
  <p><a href="https://i.stack.imgur.com/WFOf1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WFOf1.png" alt="enter image description here" /></a></p>
  <p>Although I have entered the <code>First Name</code>, <code>Last Name</code> and <code>Phone Number</code> but still I still get a validation error.</p>
  <p>On debugging I have found</p>
  <p><a href="https://i.stack.imgur.com/5Ddha.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5Ddha.png" alt="enter image description here" /></a></p>