NCache.OSS.AspNetCore.Authentication.TicketStore
5.3.603
dotnet add package NCache.OSS.AspNetCore.Authentication.TicketStore --version 5.3.603
NuGet\Install-Package NCache.OSS.AspNetCore.Authentication.TicketStore -Version 5.3.603
<PackageReference Include="NCache.OSS.AspNetCore.Authentication.TicketStore" Version="5.3.603" />
<PackageVersion Include="NCache.OSS.AspNetCore.Authentication.TicketStore" Version="5.3.603" />
<PackageReference Include="NCache.OSS.AspNetCore.Authentication.TicketStore" />
paket add NCache.OSS.AspNetCore.Authentication.TicketStore --version 5.3.603
#r "nuget: NCache.OSS.AspNetCore.Authentication.TicketStore, 5.3.603"
#:package NCache.OSS.AspNetCore.Authentication.TicketStore@5.3.603
#addin nuget:?package=NCache.OSS.AspNetCore.Authentication.TicketStore&version=5.3.603
#tool nuget:?package=NCache.OSS.AspNetCore.Authentication.TicketStore&version=5.3.603
NCache ASP.NET Core Authentication TicketStore Integration
NCache integration for the ASP.NET Core cookie authentication ITicketStore. This package keeps the serialized AuthenticationTicket in NCache instead of the cookie, so the browser carries only a small session key and the authentication session is shared by every instance of a web farm.
Installation
Install-Package NCache.OSS.AspNetCore.Authentication.TicketStore
or, using the .NET CLI:
dotnet add package NCache.OSS.AspNetCore.Authentication.TicketStore
What is Installed
Installing this package adds the following NCache configuration files to your project:
- client.ncconf — Defines the cache client settings, including the cache name and the list of server nodes the client connects to.
- config.ncconf — Contains the cache configuration (cache topology, partitions, eviction policy, etc.) used when the cache is created/registered.
Prerequisites
- .NET Standard 2.0 compatible application using
Microsoft.AspNetCore.Authentication.Cookies. - An NCache 5.3.603 (or later) server should be up and running, with the target cache already created/registered on it.
Getting Started
Setting up NCache
The servers can be given in code (shown below). If you leave ServerList empty, the client reads them from a client.ncconf in your project; in that case, if NCache is not installed on the current machine, add one and set the cache id to your cache name:
<configuration>
<ncache-server port="9800" />
<cache id="defaultCache" enable-client-logs="False" log-level="error">
<server name="10.0.0.1" />
</cache>
</configuration>
Set defaultCache to the name of your actual cache and 10.0.0.1 to the IP/hostname of a node hosting it. Mark the file to be copied to the output directory.
Setting up Package
Register the ticket store, then hand it to the cookie handler as its SessionStore:
using Microsoft.AspNetCore.Authentication.Cookies;
using NCache.OSS.AspNetCore.Authentication.TicketStore;
builder.Services.AddNCacheTicketStore(options =>
{
options.CacheName = "defaultCache";
options.ServerList.Add(new NCacheOptions.ServerConfig { Ip = "10.0.0.1", Port = 9800 });
});
builder.Services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
.AddCookie(options =>
{
options.ExpireTimeSpan = TimeSpan.FromMinutes(30);
options.SlidingExpiration = true;
});
builder.Services.AddOptions<CookieAuthenticationOptions>(CookieAuthenticationDefaults.AuthenticationScheme)
.Configure<ITicketStore>((options, store) => options.SessionStore = store);
// ...
app.UseAuthentication();
app.UseAuthorization();
The options can also be bound from configuration:
{
"NCacheTicketStore": {
"CacheName": "defaultCache",
"ServerList": [ { "Ip": "10.0.0.1", "Port": 9800 } ]
}
}
builder.Services.AddNCacheTicketStore(builder.Configuration.GetSection("NCacheTicketStore"));
If ServerList is empty, the servers in client.ncconf are used.
Configuration
Configure the store through an NCacheOptions instance. The cache must already exist on the server.
| Property | Description |
|---|---|
CacheName |
Name of the NCache cache that holds the tickets. Required. |
ServerList |
NCache server nodes to connect to (Ip, and Port which defaults to 9800). If empty, client.ncconf is used. |
Port |
Default NCache client port (9800). |
The integration provides:
AddNCacheTicketStore—IServiceCollectionextension methods that validate the options and registerNCacheTicketStoreas theITicketStore.NCacheTicketStore— TheITicketStoreimplementation (store, renew, retrieve, remove) backed by NCache.NCacheOptions— Connection settings for the store.
A ticket is stored with an absolute expiration derived from the ticket's ExpiresUtc; renewing a ticket rewrites it with the new expiry. A ticket without an expiry falls back to 14 days. Expired and signed-out sessions disappear from the cache on their own, and the cookie stays a few bytes however many claims the user carries.
Resources
Technical Support
Alachisoft provides various technical support resources.
Visit the Alachisoft Support Center to select a support resource appropriate for your issue.
To request additional features or report a documentation discrepancy, contact support@alachisoft.com.
License
Copyright © 2026 Alachisoft. All rights reserved.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Alachisoft.NCache.Opensource.SDK (>= 5.3.603)
- Microsoft.AspNetCore.Authentication.Cookies (>= 2.3.13)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.12)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.