From 05352f915bc14aa05a1b4594214d8aae16c59914 Mon Sep 17 00:00:00 2001 From: Rick Anderson <3605364+Rick-Anderson@users.noreply.github.com> Date: Fri, 10 Feb 2023 16:29:52 -1000 Subject: [PATCH] Update app-state.md (#28355) --- aspnetcore/fundamentals/app-state.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/aspnetcore/fundamentals/app-state.md b/aspnetcore/fundamentals/app-state.md index af1e51c572..5099af079b 100644 --- a/aspnetcore/fundamentals/app-state.md +++ b/aspnetcore/fundamentals/app-state.md @@ -173,6 +173,10 @@ The following example shows how to set and get a serializable object with the `S [!code-csharp[](app-state/6.0samples/SessionSample/Pages/Index6.cshtml.cs)] +> [!WARNING] +> Storing live object in session should be used with caution as there are many problems than can occur with searilized objects. For more information [see this GitHub issue](https://github.com/dotnet/aspnetcore/issues/18159) + + ## TempData ASP.NET Core exposes the Razor Pages [TempData](xref:Microsoft.AspNetCore.Mvc.RazorPages.PageModel.TempData) or Controller . This property stores data until it's read in another request. The [Keep(String)](xref:Microsoft.AspNetCore.Mvc.ViewFeatures.ITempDataDictionary.Keep*) and [Peek(string)](xref:Microsoft.AspNetCore.Mvc.ViewFeatures.ITempDataDictionary.Peek*) methods can be used to examine the data without deletion at the end of the request. [Keep](xref:Microsoft.AspNetCore.Mvc.ViewFeatures.ITempDataDictionary.Keep*) marks all items in the dictionary for retention. `TempData` is: