title: Passing UserID through a ViewBag
body: <p>I am trying to save the Identities UserID in a create action.</p>
  
  <p>Controller GET request is as follows:</p>
  
  <pre><code>// GET: Owners/Create
  public ActionResult Create()
  {
      ViewBag.RegUser = User.Identity.GetUserId();
      return View();
  }
  </code></pre>
  
  <p>View is as follows:</p>
  
  <pre><code>@Html.HiddenFor(model =&gt; model.RegUserID, new { @value = ViewBag.RegUser })
  </code></pre>
  
  <p>Controller POST request is as follows:</p>
  
  <pre><code>// POST: Owners/Create
  // To protect from overposting attacks, please enable the specific properties you want to bind to, for 
  // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
  [HttpPost]
  [ValidateAntiForgeryToken]
  public ActionResult Create([Bind(Include = "OwnerID,OwnerName,ContactName,PhysicalAddress1,PhysicalAddress2,PhysicalCity,PhysicalState,PhysicalCountry,PhysicalPostCode,PostalAddress1,PostalAddress2,PostalCity,PostalState,PostalCountry,PostalPostCode,Phone,Mobile,Fax,Email,RegUserID")] Owner owner)
  {
      if (ModelState.IsValid)
      {
          db.Owners.Add(owner);
          db.SaveChanges();
          return RedirectToAction("Index");
      }
  
      return View(owner);
  }
  </code></pre>
  
  <p>However when the record is saved the RegUserID is null.</p>
  
  <p>If I break on the @Html Helper were the value is assigned to model.RegUserID I can see the UserID in a view:</p>
  
  <pre><code>ViewBag.RegUser "7318611e-7e2e-4ee2-9c7b-51b20f0806d8"  dynamic {string}
  </code></pre>
  
  <p>What am I doing wrong?</p>