TempData is a temporary dictionary for carrying small values across requests. It is especially useful when a form submission redirects to another page and that page needs a short-lived message or value. section 15.4.1 section 17.2.3
Use TempData when:
- A POST handler redirects to a GET handler in the POST-REDIRECT-GET pattern. section 17.2.3
- The value is small and should be available only temporarily. section 15.4.1
- You need dictionary entries with string keys rather than ordinary PageModel properties. section 17.2.3
By default, ASP.NET Core stores TempData in an encrypted cookie. Other storage options are available. For ordinary data displayed by one page, prefer PageModel properties; use TempData for short-lived values that must survive a redirect. section 17.2.3
Figure 15.3 A typical POST, REDIRECT, GET flow through a website. A user sends their shopping basket to a checkout page, which validates its contents and redirects to a payment page without the user’s having to change the URL manually.
Follow the POST-REDIRECT-GET flow to see where temporary data is needed between the submitting page and the destination page. section 15.4.1

