1 Answers

Harsh kumar srivastava
Harsh kumar srivastava

ViewData and ViewBag are almost similar,and TempData carry out additional responsibility.

The main difference between ViewBag and ViewData is, ViewBag is a dynamic property that takes benefit of the new dynamic features in C# 4.0. And ViewData is a dictionary of objects that is derived from ViewDataDictionary class and is attainable using strings as keys.

Now we Discuss about TempData,

TempData helps to maintain data when you move from one controller to other controller or from one action to other action. TempData internally uses session variables.