title: Session State is erased after calling RedirectToAction() in ASP.NET MVC 3
body: <p>I use a simple sequences: </p>
  
  <ol>
  <li>Set a Session State in [HttpGet] method.</li>
  <li>Redirect to another action using RedirectToAction() in [HttpPost] method.</li>
  <li>Want to get the value of that Session State, in the destination.</li>
  </ol>
  
  <p>Problem:</p>
  
  <p>If user hits "submit" button on my "Table" view, all the data inside session got cleared and I can't get them in the destination action (which is "Table"). Here is the code:</p>
  
  <pre><code>   [HttpGet]
      public ActionResult Edit(string TableName, int RowID, NavigationControl nav)
      {
          if (nav != null) Session["NavigationData"] = nav;
  
          myService svc = new myService (_repository);
          EditViewModel model = new EditViewModel();
  
          model.TableDefinitions = svc.GetTableDefinition(TableName);
          model.RowData = svc.GetRowData(model.TableDefinitions.Name, RowID);
  
          return View(model);
      }
  
      [HttpPost]
      public ActionResult Edit(EditViewModel model)
      {
          MyService svc = new MyService (_repository);
          svc.SaveRowData(model.TableDefinitions.Name, model.RowData);
          return RedirectToAction("Table");
      }
  
      public ActionResult Table(string TableName)
      {
          myService svc = new myService (_repository);
  
          TableViewModel model = new TableViewModel();
          model.TableDefinition = svc.GetTableDefinition(TableName);
  
          NavigationControl nav = (NavigationControl)Session["NavigationData"];
          if (nav != null)
          {
              model.NavigationControl = nav;
          }
  
          return View(model);
      }
  </code></pre>
  
  <p>and Session["NavigationData"] is always null when user reaches it via: return RedirectToAction("Table").
  If user hits an HTML link on "Edit" View, Session["NavigationData"] can restore its value in "Table" method!</p>
  
  <p>Any idea about what's going on?
  Who deletes the Session state?!</p>