Today, I am explaining about TempData vs ViewData vs Viewbag while working in MVC. Each one of the three (TempData, ViewData, ViewBag) terms are used to pass data from controller to View. These all have differing capacity to shield data while going from Controller to View using MVC application. In my recent articles, Explained thoroughly How to send SMS using C# and How to create charts using MVC


  1. ViewBag is used logically to pass the data from controller to view.
  2. It is being introduced since C# 4.0 .Net Framework.
  3. ViewData is property of ControllerBase Class from .Net Framework 4.5 C# first time.
  4. ViewBag life reach is short. It just lies under current requesting.
  5. If it redirects then its value becomes null.
  6. It doesn't required to typecasting for getting data from Controller to View.
  7. ViewBag is slower than ViewData.