In my index I added a search field.
When user enter a search term and click filter the index (Index) is filtered. So far so good.
What I would like to achieve
Judging by many older Stack Overflow posts and articles out there, it seems TempData
only lasted until the next request in prior versions of ASP.NET. However, that is not the case as of .NET Core according to Microsoft:
ASP.NET Core exposes the Razor Pages
TempData
or ControllerTempData
. This property stores data until it's read in another request. TheKeep(String)
andPeek(string)
methods can be used to examine the data without deletion at the end of the request.Keep
marks all items in the dictionary for retention.
Another claim I see repeatedly about TempData
is how it is implemented using sessions, but that isn't the default mechanism as of .NET Core:
The cookie-based
TempData
provider is enabled by default. To enable the session-basedTempData
provider, use theAddSessionStateTempDataProvider
extension method.
Source: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/app-state?view=aspnetcore-3.1#tempdata