Core.AspNet.Web.SessionState 1.0.0.26281

dotnet add package Core.AspNet.Web.SessionState --version 1.0.0.26281
                    
NuGet\Install-Package Core.AspNet.Web.SessionState -Version 1.0.0.26281
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Core.AspNet.Web.SessionState" Version="1.0.0.26281" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Core.AspNet.Web.SessionState" Version="1.0.0.26281" />
                    
Directory.Packages.props
<PackageReference Include="Core.AspNet.Web.SessionState" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Core.AspNet.Web.SessionState --version 1.0.0.26281
                    
#r "nuget: Core.AspNet.Web.SessionState, 1.0.0.26281"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Core.AspNet.Web.SessionState@1.0.0.26281
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Core.AspNet.Web.SessionState&version=1.0.0.26281
                    
Install as a Cake Addin
#tool nuget:?package=Core.AspNet.Web.SessionState&version=1.0.0.26281
                    
Install as a Cake Tool

AspNetCore.Web.SessionState

Out-of-process session state: <sessionState mode="StateServer"> and mode="SQLServer", with the web.config you already have.

<PackageReference Include="AspNetCore.Web.SessionState" Version="1.0.0" />

Not needed for mode="InProc", which AspNetCore.Web.Base handles on its own.

Assembly vs package name. The package is AspNetCore.Web.SessionState; the assembly inside it is Core.Web.SessionState. .NET ships an empty System.Web.dll facade in Microsoft.NETCore.App and the host gives the shared framework precedence, so an app-local System.Web.dll is never loaded — the port therefore cannot use the original assembly names. Namespaces are unchanged, so your code and Inherits= attributes are unaffected; only web.config entries that name an assembly need updating.

Usage

var builder = WebApplication.CreateBuilder (args);

// mode="StateServer" only. AddDistributedMemoryCache () for a single instance.
builder.Services.AddStackExchangeRedisCache (o => o.Configuration = "localhost:6379");

var app = builder.Build ();

app.UseWebFormsSessionState ();     // BEFORE UseWebForms

app.UseWebForms (options => { /* ... */ });

UseWebFormsSessionState is a no-op for InProc and Off, so it is safe to call unconditionally. It exists because the session store is built by the provider model — Activator.CreateInstance on a type named in configuration — which has no access to dependency injection.

Neither store is the one the words used to mean

Mode What actually stores the session
StateServer The IDistributedCache you registered — Redis, SQL Server, NCache, in-memory. Not aspnet_state.exe; stateConnectionString is ignored.
SQLServer The stock ASPState database, through its standard stored procedures. An existing aspnet_regsql-provisioned database needs no DDL.

Mono's own implementations could not be used: its StateServer handler is built on .NET Remoting, a CLR feature CoreCLR does not have, and its SQL handler targets a Mono-invented table through a SQLite factory this port excludes.

For a new ASPState database, aspnet_regsql.exe does not exist on .NET 10 — the script ships in the assembly:

Console.WriteLine (SqlSessionStateStore.GetSchemaScript ());   // for a DBA to review
SqlSessionStateStore.EnsureSchema (connectionString);          // or run it directly; idempotent

Four things to know

  • Existing session data does not migrate. Sessions written by .NET Framework contain BinaryFormatter payloads and .NET 9+ cannot read them. Reuse the Redis instance or the database — the infrastructure — but treat the cutover as a session flush.
  • Everything in Session must now serialize. InProc never wrote a session down, so a type that has worked for years can fail the first time the mode changes, with no other edit. The failure names both the type and the mode.
  • StateServer locking is best-effort. IDistributedCache has no compare-and-swap, so two simultaneous requests for one session can both believe they hold the lock; the result is last-writer-wins, not corruption. SQLServer has no such window.
  • Session_End never fires under either mode. Only InProc could ever raise it.

Under SQLServer, schedule dbo.DeleteExpiredSessions yourself — nothing reads expired rows, so skipping it costs disk rather than correctness.

Documentation

PORTING-GUIDE.md (step-by-step migration from IIS) and LIMITATIONS.md (what differs from ASP.NET on .NET Framework, and why) ship in the repository.

Licence

MIT, as the upstream Mono sources this is built from and the code written for this port. THIRD-PARTY-NOTICES.md ships in the package and says which part is which.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0.26281 94 10/8/2026