Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion aspnetcore/migration/inc/samples/wrapped/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
options.RegisterKey<int>("test-value");
options.RegisterKey<SessionDemoModel>("SampleSessionItem");
})
.WrapAspNetCoreSession();
.AddWrappedAspNetCoreSession();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// </snippet_WrapAspNetCoreSession>

var app = builder.Build();
Expand Down
10 changes: 6 additions & 4 deletions aspnetcore/migration/inc/wrapped.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,19 @@ description: Wrapped ASP.NET Core session state
author: rick-anderson
ms.author: riande
monikerRange: '>= aspnetcore-6.0'
ms.date: 11/9/2022
ms.date: 2/24/2025
ms.topic: article
uid: migration/inc/wrapped
---

# Wrapped ASP.NET Core session state

This implementation wraps the session provided on ASP.NET Core so that it can be used with the adapters. The session will be using the same backing store as `Microsoft.AspNetCore.Http.ISession` but will provide strongly-typed access to its members.
The [AddWrappedAspNetCoreSession](https://github.com/dotnet/systemweb-adapters/blob/main/src/Microsoft.AspNetCore.SystemWebAdapters.CoreServices/SessionState/Wrapped/WrappedSessionExtensions.cs) implementation wraps the session provided on ASP.NET Core so that it can be used with the adapters. The session uses the same backing store as [`Microsoft.AspNetCore.Http.ISession`](/dotnet/api/microsoft.aspnetcore.http.isession) but provides strongly-typed access to its members.

Configuration for ASP.NET Core would look similar to the following:
Configuration for ASP.NET Core looks similar to the following:

:::code language="csharp" source="~/migration/inc/samples/wrapped/Program.cs" id="snippet_WrapAspNetCoreSession" :::

The framework app would not need any changes to enable this behavior.
The framework app doesn't need any changes to enable this behavior.

For more information, see the [AddWrappedAspNetCoreSession sample app](https://github.com/dotnet/systemweb-adapters/blob/main/samples/CoreApp/Program.cs)