title: What is the best way in MVC to share a Layout object with between multiple HTML Helpers
body: <p>I am new to .NET MVC and am looking for a code or non-code answer to a this question.  My web application will have hundreds of controllers, partial controllers, etc.  All the controllers will share a common layout.  I am currently adding a <strong>Menu</strong> object to the ViewBag from the page's controller.</p>
  
  <p>I'd like to know what is best practice for re-using an object multiple times in an MVC Layout view (similar to the <strong>Menu</strong> object in my example, below)?</p>
  
  <pre><code>@Html.Header(ViewBag.Menu as IR.Web.Portal.Models.Navigation.Menu)
  @Html.SideNav(ViewBag.Menu as IR.Web.Portal.Models.Navigation.Menu)
  @Html.Footer(ViewBag.Menu as IR.Web.Portal.Models.Navigation.Menu)
  </code></pre>
  
  <ol>
  <li><p>I want to initialize the object only once but use it many times.</p></li>
  <li><p>I do not want to add code to every controller to make it work.  Inheritance a base controller might be a good solution.</p></li>
  <li><p>The <strong>Menu</strong> object does not need to be in the ViewBag as it is in my example.</p></li>
  <li><p>The <strong>Menu</strong> object will be different for every user of the site.  So, Static or Singleton classes are probably out of consideration.</p></li>
  </ol>