14. Using TempData to Pass Data from a Controller to a View

Опубликовано: 29 Сентябрь 2024
на канале: Ervis Trupja
306
3

In ASP.NET MVC, TempData is used to pass data from the controller to the view, but it's designed for temporary storage, meaning it's meant to be used for a single redirect. TempData is a dictionary stored in session state and is capable of keeping data for the duration of an HTTP request. It's ideal for scenarios such as passing error messages or status data after a redirect, where ViewData and ViewBag would not persist the data after the redirect. Once TempData is read in the view, the information is discarded.
------------
🔗 Source Code: https://github.com/etrupja/Shortly
------------
✅ Full course: https://bit.ly/49nbHIN
------------
🌐 Connect & Learn:
- Blog: https://dotnethow.net
- Udemy: https://www.udemy.com/user/ervis-trupja
- Pluralsight: https://www.pluralsight.com/authors/e...
- LinkedIn:   / ervis-trupja  
------------
Check out my Udemy courses:
- ASP.NET MVC eCommerce App - https://bit.ly/3CWvkqk
- ASP.NET Web API Guide - https://bit.ly/3co3ZBG
------------