All of them are properties of Controllers and Views, and all of them are used to transport very small amount of data between pages.
ViewData: It is of dictionary type, used to store key/value pairs and transmit them between controllers and views.
ViewBag: It is a wrapper built above ViewData, but it is dynamic in nature as appose to ViewData.
TempData: It is also a dictionary type property, but it is only used between subsequent request and is very short lived
While redirecting from one controller, both ViewBag and ViewData properties cannot be used, but TempData property can be used to transport data, as it works for subsequent requests.
This site uses Akismet to reduce spam. Learn how your comment data is processed.