Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The AddWrappedAspNetCoreSession 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
but provides strongly-typed access to its members.
Configuration for ASP.NET Core looks similar to the following:
builder.Services.AddSystemWebAdapters()
.AddJsonSessionSerializer(options =>
{
// Serialization/deserialization requires each session key to be registered to a type
options.RegisterKey<int>("test-value");
options.RegisterKey<SessionDemoModel>("SampleSessionItem");
})
.AddWrappedAspNetCoreSession();
The framework app doesn't need any changes to enable this behavior.
For more information, see the AddWrappedAspNetCoreSession sample app
ASP.NET Core