TempData
TempData is an ASP.NET Core temporary-data dictionary for storing values across requests, commonly through cookies.
Pro ASP.NET Core 7, Tenth Edition
The TempData property exposes the controller or Razor view's temporary request-to-request data dictionary.
- How it is used
- Carries temporary values across a redirect so the next controller view or Razor Page can display them.
- How deep it goes
- Explains dictionary writes, view reads, storage choice, and deletion timing through a worked redirect; it does not detail storage configuration.
- Examples
- Uses a cube-result form, redirected form-results tables, and a related-data creation flow that preserves an unfinished edit.
- What you can do after
- Apply it via ASP.NET Core TempData to pass simple or serialized values to a redirected view or page.
Read how Pro ASP.NET Core 7, Tenth Edition explains TempData →
ASP.NET Core in Action, 3e
TempData is an ASP.NET Core temporary-data mechanism that stores small values for retrieval during a subsequent request, commonly using cookies.
- How it is used
- Carries small, short-lived values through a redirect, especially in the POST-REDIRECT-GET pattern.
- How deep it goes
- Defines dictionary behavior, request lifetime, default storage, and alternatives but does not provide implementation code.
- Examples
- Uses an e-commerce checkout redirect and contrasts TempData with PageModel properties and ViewData.
- What you can do after
- Apply it via ASP.NET Core's TempData mechanism when a redirect must carry a small temporary value.
Related concepts
- ViewBagcontrasts with · ViewBag is a dynamic ASP.NET Core MVC property bag for passing unstructured data from a controller or view component to a view.
- http redirectuses · An HTTP redirect is a response that instructs a client to request or display a resource at a different location.
- post-redirect-getuses · POST-Redirect-GET is a web interaction pattern in which a form submission is followed by a redirect to a result URL retrieved with GET.
- cookieuses · An HTTP cookie is a small piece of data that a server asks a user agent to store and return with subsequent requests within its scope.
- Mapkind of · A map is an associative data structure that stores key-value pairs and supports retrieving values by key.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

