title: Store object in session variables
body: <p>I have a dropdown menu that when you select an option value submit the form, and to avoid repetitive database calls I am storing my non-sensitive object in a session.</p>
  
  <pre><code>private List&lt;Employee&gt; stafflist
  {
      get { return Session["stafflist"] as List&lt;Employee&gt;; }
      set { Session["stafflist"] = new Employee(); }
  }
  private void RemoveStaff()
  {
      Session.Remove("stafflist");
  }
  </code></pre>
  
  <p>however in my </p>
  
  <pre><code>[HttpPost]
  public ActionResult index (...)
  {
      //why can't I get the list of staff like this?
      ViewBag.staff=stafflist.Where(..).toList();
  
      //is the below still needed? i thought i 
      //have a session variable declare above, 
      //and to avoid 30x repetitive db calls? 
      //also note when i include the below the code runs fine, 
      //however, if i take it out it doesn't. i would like to avoid repetitive db calls
      stafflist=db.Employee.toList(); 
  }
  </code></pre>