title: Passing a class object from one controller action to different controller action in ASP.net MVC 4
body: <p>I want to pass a class object from one controller action to different controller's action.</p>
  
  <p><strong>Sender Action</strong></p>
  
  <pre><code>public class CourseController : Controller
  {
  [HttpPost]
  public ActionResult CreateNewCourse(CourseViewModelBase courseViewModel)
  {
     if (ModelState.IsValid)
     {
         // Do some stuff
         return RedirectToAction("CreateNewProject", "Project",
                            new { courseVM = courseViewModel});
     }
     // Bad happened    
     return View("CreateNewCourse", courseViewModel);
  }
  </code></pre>
  
  <p><strong>Receiver Action</strong>  </p>
  
  <pre><code>public class ProjectController : Controller
  {
  [HttpGet]
  public ActionResult CreateNewProject(CourseViewModelBase courseVM)
  {
        // Use CourseVM data and do other stuff
       return View("Create", projectCreateViewModel);
  }
  }
  </code></pre>
  
  <p>I am getting data properly in <strong>Sender Action</strong> and <strong>Receiver Action</strong> is called properly from the redirect to action call. However <strong>courseVM</strong> in <strong>Receiver Action</strong> is <strong>null</strong>. </p>
  
  <p>I know this is a very old question and had been asked repetitively. But I found that most of the answers suggested to use <code>TempData</code> and were answered in 2008/2009. I believe there would be someway to pass data using <code>RedirectToAction without using TempData</code>. If there is not then I would go with TempData only.</p>
  
  <p><strong>Finding</strong>
  If I pass some simple data e.g. <code>new {id = courseViewModel.CourseDuration}</code> and change the argument in Receiver action to id then id is properly received.</p>
  
  <p><strong>Similar Questions</strong> 
  <a href="https://stackoverflow.com/q/15385442/351708">Question 1</a><br>
  <a href="https://stackoverflow.com/q/7544868/351708">Question 2</a><br>
  <a href="https://stackoverflow.com/q/1936/351708">Question 3</a><br>
  <a href="https://stackoverflow.com/q/129335/351708">Question 4</a><br>
  <a href="https://stackoverflow.com/q/2746094/351708">Question 5</a><br>
  <a href="https://stackoverflow.com/q/5409899/351708">Question 6, tried to use this one but did not workout</a><br>
  <a href="https://stackoverflow.com/q/1164021/351708">Question 7</a><br>
  <a href="https://stackoverflow.com/q/3037607/351708">Question 8</a><br>
  <a href="https://stackoverflow.com/q/328474/351708">Question 9</a><br>
  <a href="https://stackoverflow.com/q/279665/351708">Question 10</a>  </p>
  
  <p><em>Most of the answers in above questions are dated back in 2008/09 and uses tempdata</em>. </p>