NCV.ISPSession 13.0.2

dotnet add package NCV.ISPSession --version 13.0.2
                    
NuGet\Install-Package NCV.ISPSession -Version 13.0.2
                    
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="NCV.ISPSession" Version="13.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NCV.ISPSession" Version="13.0.2" />
                    
Directory.Packages.props
<PackageReference Include="NCV.ISPSession" />
                    
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 NCV.ISPSession --version 13.0.2
                    
#r "nuget: NCV.ISPSession, 13.0.2"
                    
#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 NCV.ISPSession@13.0.2
                    
#: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=NCV.ISPSession&version=13.0.2
                    
Install as a Cake Addin
#tool nuget:?package=NCV.ISPSession&version=13.0.2
                    
Install as a Cake Tool

NCV.ISPSession

A Redis-backed session and application state library for ASP.NET Core 8+.

Drop-in alternative to the built-in distributed session, with encrypted Redis keys, per-key application state with expiration events, automatic compression, and a lightweight optimistic-concurrency strategy that only writes when state actually changes.

dotnet add package NCV.ISPSession

MIT-licensed. No telemetry. No phone-home. Source on GitHub.


Why NCV.ISPSession instead of Microsoft.Extensions.Caching.StackExchangeRedis?

Feature NCV.ISPSession Microsoft.Extensions.Caching.StackExchangeRedis
Distributed session backed by Redis
AES-encrypted Redis keys
Automatic Brotli compression of session blob
Application-wide state (shared across nodes)
Per-key expiration callbacks (keyspace Ex)
Affinity via cookie, header or IP address
Optimistic concurrency — write-on-change only
Bundled GET/SET/DEL per ASP.NET request scope

If you only need a plain key/value cache, the Microsoft package is fine. If you want session and application state with the features above, this library is built for that.


Getting Started

Prerequisites

  • .NET 8.0 or later
  • Redis 4.0 or later

Install

dotnet add package NCV.ISPSession

Configure

Add a Redis connection string in appsettings.json (or appsettings.Development.json):

{
  "ConnectionStrings": {
    "IspSession": "localhost:6379"
  }
}

Wire it up in Program.cs — see the demo project for a complete example.

Verify

Start your app and call any endpoint that uses session state. Hitting the same endpoint again should increment your counter:

curl https://localhost:7058/counterwithapp
{
  "sessionCounter": 1,
  "isNewSession": true,
  "isExpiredSession": true,
  "sessionId": "39ecbd08-662e-4123-95e8-fc559446c73d",
  "appCounter": 2
}

Optional: enable expiration events

To use the per-key expiration callbacks, Redis needs keyspace notifications. The library tries to set this dynamically, but the durable fix is to add this to redis.conf:

notify-keyspace-events Ex

How it works

  • SessionState — all session variables are serialized to a single blob, optionally Brotli-compressed, AES-encrypted, and stored under one Redis key per session. Reads and writes are bundled per ASP.NET request scope; nothing hits Redis if you only read.
  • ApplicationState — opt-in. Application-wide variables are stored as individual Redis keys so each one can have its own expiration and fire a callback when it expires.
  • Affinity — session identity can be carried via cookie, custom header, or (with obfuscation for GDPR compliance) the client IP address. Useful for REST APIs where cookies aren't always available.

See SessionState.cs and ApplicationState.cs for the public surface.


License

MIT — see LICENSE.txt. Free for any use, including commercial.

If the library saves you time, buy me a coffee ☕.

Copyright © 2024–2026 Nierop Computer Vision.

Product Compatible and additional computed target framework versions.
.NET 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 was computed.  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
13.0.2 88 5/24/2026
13.0.1 79 5/24/2026
13.0.0 108 4/28/2026
12.0.20 263 5/22/2025
12.0.19 297 5/13/2025
12.0.16 231 5/8/2025
12.0.15 272 4/24/2025
12.0.4 257 4/22/2025
11.0.13 196 3/2/2025
11.0.12 184 2/28/2025
Loading failed

Repository Moved to github.com/egbertn/ispsession. This is a maintenance release with no code changes, just updating the repository URL and package metadata. See