title: ASP MVC 3, how to set model properties in controller?
body: <p>I've got a view with a submit formular (Html.BeginForm()), and want to set some model properties <em>in the controller</em>, returning the view, hoping to see this properties in the view.</p>
  
  <p>Here is my pattern on the standard MVC 3 logon formular.</p>
  
  <p><strong>Precision</strong>: <em>I really want to set these properties within the POST treatment, not in a GET.</em></p>
  
  <p>Could you please explain why my properties set in the controller are never displayed on the view?</p>
  
  <pre><code> [HttpPost]
      public ActionResult LogOn(LogOnModel model, string returnUrl)
      {
          model.RememberMe = true;
          model.UserName = "foobar";
  
          return View(model);
      }
  </code></pre>
  
  <p>With a view like the standard LogOn.cshtml:</p>
  
  <pre><code> @using (Html.BeginForm()) {
          &lt;div&gt;
              &lt;fieldset&gt;
                  &lt;legend&gt;Account Information&lt;/legend&gt;
  
                  &lt;div class="editor-label"&gt;
                      @Html.LabelFor(m =&gt; m.UserName)
                  &lt;/div&gt;
                  &lt;div class="editor-field"&gt;
                      @Html.TextBoxFor(m =&gt; m.UserName)
                      @Html.ValidationMessageFor(m =&gt; m.UserName)
                  &lt;/div&gt;
  
                  &lt;div class="editor-label"&gt;
                      @Html.LabelFor(m =&gt; m.Password)
                  &lt;/div&gt;
                  &lt;div class="editor-field"&gt;
                      @Html.PasswordFor(m =&gt; m.Password)
                      @Html.ValidationMessageFor(m =&gt; m.Password)
                  &lt;/div&gt;
  
                  &lt;div class="editor-label"&gt;
                      @Html.CheckBoxFor(m =&gt; m.RememberMe)
                      @Html.LabelFor(m =&gt; m.RememberMe)
                  &lt;/div&gt;
  
                  &lt;p&gt;
                      &lt;input type="submit" value="Log On" /&gt;
                  &lt;/p&gt;
              &lt;/fieldset&gt;
          &lt;/div&gt;
      }
  </code></pre>