Provides scalable session state and application state management using Redis, designed for distributed ASP.NET Core backends. Supports BFF, OpenID Connect, and high-performance scenarios without relying on in-memory session state.
$ dotnet add package NCV.ISPSessionThank you for your support. I am sure you will love ISP Session.
This software is licensed under the terms found in the LICENSE.txt file located in the project root. Please refer to the LICENSE file for the full text of the license. https://buymeacoffee.com/egbert
Copyright © 2024, 2025 Nierop Computervision. All rights reserved.
Isp Session provides a mechanism, utilizing cookies, headers, or even IP addresses**, to maintain state affinity in your REST API or ASP.NET 8+ driven website. It facilitates application-level caching by combining Application State and Session State, which can be utilized together or independently.
** We adhere to privacy laws by implementing obfuscation for IP addresses when this feature is utilized.
The Redis Session State Library offers a robust and efficient solution for session state management in .NET 8 applications, leveraging Redis 4 or later as the backend. Our solution employs advanced data projection techniques for encrypting the session state, securing your data at all times.
Isp Session debuts at version 10.0, following the author's previous releases of Isp Session/Asp Session for classic ASP pages, which reached version 8.2. Available at https://github.com/egbertn/ispsession.io, Isp Session has been completely rewritten from scratch to leverage the best features of .NET 8.0, incorporating best practices learned from previous versions.
To clone our demo from GitHub, use:
git clone https://github.com/egbertn/ispsession.coreIf Redis is already running on your system with default settings, IspSession should connect seamlessly. Otherwise, for custom settings like a required password, modify the connection string in appsettings.Development.json. For example:
{
"ConnectionStrings": {
"IspSession": "localhost:6379"
}
}Start the site in debugging mode and note the chosen port from the console output, e.g.:
info: Microsoft.Hosting.Lifetime[14] Now listening on: https://127.0.0.1:7058
info: Microsoft.Hosting.Lifetime[14] Now listening on: http://127.0.0.1:5045Use curl to test the connection:
curl https://localhost:7058/counterwithappYou should receive a response similar to:
{
"sessionCounter": 1,
"isNewSession": true,
"isExpiredSession": true,
"sessionId": "39ecbd08-662e-4123-95e8-fc559446c73d",
"appCounter": 2
}Using a browser like Firefox should set and return a cookie, and refreshing the URL should increment both the sessionCounter and appCounter.
Note: Isp Session supports unlimited testing, development, and staging as long as the remote IP originates from a private network. License requirements are enforced upon deployment or when proxies are detected.
Redis configuration. If you want expiration notifications which ISP Session supports, you should modify redis.conf to have this line (at least including Ex) notify-keyspace-events Ex ISP Session attempts to set this configuration dynamically, which is not permanent, but it is preferable to modify redis.conf (permanently) since restrictions may be applied to software using Redis (such as ISP Session).
To install the Redis Session State Library, execute the following NuGet command:
dotnet add package NCV.ISPSessionISP Session optimizes performance through techniques like handling numeric endianness, minimal .NET memory heap impact, AES encryption for Redis keys, and efficient storage for complex and simple data types. It employs an optimistic concurrency strategy to prevent data overwrites and writes session state changes only when necessary, ensuring efficient data management and security.
SessionState Manages session variables as a single blob, supporting optional compression for large data sets.
ApplicationState: Activated via configuration, storing variables individually to optimize performance and support variable-specific expiration events.