title: How to get ASP.NET MVC ModelState.IsValid() to pick up on changes i made to the model
body: <p>I've got a auto-generated Create action in my controller, I've changed things a little, I have to modify the submitted model before I call ModelState.IsValid(). </p>
  
  <p>But the IsValid() is still saying its failed, I think this is because it goes off the received parameter, and ignores the changes I've made? How can I get it to validate after I've changed things?</p>
  
  <p>Thanks</p>
  
  <p>Controller code:</p>
  
  <pre><code>[HttpPost]
          [CaptchaValidator]
          [AcceptVerbs(HttpVerbs.Post)]
          public ActionResult Register(User user, bool captchaValid)
          {
              user.prepareUserForCreation();
              if (ModelState.IsValid &amp;&amp; captchaValid)
              {
                  db.Users.Add(user);
                  db.SaveChanges();
                  return RedirectToAction("Index");
              }
  
              ViewData["captchaValidationMessage"] = captchaValid ? "" : "Your words didn't match, please try again";
  
              return View(user);
          }
  </code></pre>
  
  <p>Prepare method:</p>
  
  <pre><code>public void prepareUserForCreation()
          {
              this.DateCreated = DateTime.Now;
              this.LastSeen = DateTime.Now; //TODO remove this
              this.IsActivated = true; //TODO remove this
          SecurityHelper.HashPassword(this);
          }
  </code></pre>
  
  <p>Basically its saying password is null.</p>