State Across Requests in MVC: TempData, Session, Cookies and Query Strings — Which One When?
Use the query string for filters, a consented cookie for preferences, a Data Protection cookie for an anonymous cart, session with Redis for a multi-step form and TempData for flash messages. Running Bookstore.Web on two instances, we show with real output how in-memory session silently resets the form, how separate key rings empty the cart and how cookie consent switches off TempData.
15 Nov 2026
·
14 min
·
9