What is TempData collection used for in asp.net MVC?

What is the actual use of TempData collection in asp.net MVC, I need pros and cons of that collection, and when do I need to use it, which views it is shared upon, or any useful information about it, finally if someone can tell me when to use it rather than ViewData?

Thanks in advance

CLOSED as exact duplicate of Difference Between ViewData and TempData?

Answers


TempData is used to share data between controller actions. If your controller does a RedirectToAction and the target action needs data (perhaps a particular model instance) to act upon, you can store this data in TempData. Using TempData is similar to storing it in the session, but only for one round-trip. You use TempData when you need to pass data to another controller action rather than a view for rendering.


Need Your Help

Why local_db.bin doesn't create by GAE?

java google-app-engine jpa intellij-idea google-cloud-datastore

I was using GAE 1.8.8 and application was working fine. For improvement I needed to change my entity class. I found the simplest way on local machine is deleting local_db.bin file directly from out/

SQL Query re-write help

sql sql-server sql-server-2005 performance

I need to rewrite the query below so that it is as efficient as possible. Any suggestions on how to increase the performance of this query? I plan on setting columns t2_1 and t2_2 to not nullable...