Where does TempData get stored in the ASP.NET MVC Framework (more specifically, ASP.NET MVC 2)? Is it stored at server-side, or is sent to the client?
相关问题
- MVC-Routing,Why i can not ignore defaults,The matc
- parameters in routing do not work MVC 3
- There is no ViewData item with the key 'taskTy
- TextBoxFor decimal
- Install ASP.NET 5.0 version of System.ServiceModel
相关文章
- “Dynamic operations can only be performed in homog
- How to get a list of connected clients on SignalR
- How do you redirect to the calling page in ASP.NET
- Change color of bars depending on value in Highcha
- The program '[4432] iisexpress.exe' has ex
- ASP.Net MVC 4 Bundles
- How to get server path of physical path ?
- Cannot implicitly convert Web.Http.Results.JsonRes
By default TempData uses the ASP.NET Session as storage. So it is stored on the server (
InProc
is the default). But you could define other ASP.NET Session state modes: StateServer and SqlServer. You could also write a custom TempData provider and handle the storage yourself if you don't want to use the ASP.NET Session.It is stored in session storage, but there is one crucial difference between
TempData
andSession
:TempData
is available only for a user’s session, so it persists only till we have read it and gets cleared at the end of an HTTP Request.A scenario that fits the usage of
TempData
, is when data needs to persist between two requests – a redirect scenario. Another scenario I can think of is to return an error message after a POST operation fails.