title: ASP.NET MVC4 pulling parameter out of url and sending in hidden form value
body: <p>I have a parameter I am passing in a url.  When the user clicks the url they are taken to the site which allows them to enter additional information. (Password Reset)  I need to take the token I pass as part of the url and put it in the model I submit to another controller which verifies the token and password and resets the password if verified.  I can't figure out how to get the passed parameter in the model.  </p>
  
  <p>My controller:</p>
  
  <pre><code>[AllowAnonymous]
  public ActionResult TokenPasswordReset(string token)
  {
     return View();
  }
  </code></pre>
  
  <p>My url I generate is </p>
  
  <pre><code>http://localhost:53272/Account/TokenPasswordReset?wzBXjkT1Y8qmWIECwSIFYQ2
  </code></pre>
  
  <p>In my view I try to set the hidden model value with.</p>
  
  <pre><code>&lt;fieldset&gt;
          &lt;legend&gt;Reset Password Form&lt;/legend&gt;
          &lt;ol&gt;
              &lt;li&gt;
                  @Html.LabelFor(m =&gt; m.NewPassword)
                  @Html.PasswordFor(m =&gt; m.NewPassword)
              &lt;/li&gt;
              &lt;li&gt;
                  @Html.LabelFor(m =&gt; m.ConfirmPassword)
                  @Html.PasswordFor(m =&gt; m.ConfirmPassword)
              &lt;/li&gt;
          &lt;/ol&gt;
          @Html.HiddenFor(model.UserToken = Request.Params["token"])
          &lt;input type="submit" value="TokenPasswordReset" /&gt;
      &lt;/fieldset&gt;
  </code></pre>
  
  <p>The password and confirm password are fine.  I can't figure out how to pull the token out of the url and get it into the model.UserToken.  When I do this I get an error that says </p>
  
  <blockquote>
    <p>The name 'model' does not exist in the current context</p>
  </blockquote>
  
  <p>EDIT: When I change to Model as suggested below I get a new error.  For some reason it does not pick up the Model in the HiddenFor.</p>