MintPlayer.AspNetCore.SpaServices.Xsrf 10.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package MintPlayer.AspNetCore.SpaServices.Xsrf --version 10.2.0
                    
NuGet\Install-Package MintPlayer.AspNetCore.SpaServices.Xsrf -Version 10.2.0
                    
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="MintPlayer.AspNetCore.SpaServices.Xsrf" Version="10.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MintPlayer.AspNetCore.SpaServices.Xsrf" Version="10.2.0" />
                    
Directory.Packages.props
<PackageReference Include="MintPlayer.AspNetCore.SpaServices.Xsrf" />
                    
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 MintPlayer.AspNetCore.SpaServices.Xsrf --version 10.2.0
                    
#r "nuget: MintPlayer.AspNetCore.SpaServices.Xsrf, 10.2.0"
                    
#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 MintPlayer.AspNetCore.SpaServices.Xsrf@10.2.0
                    
#: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=MintPlayer.AspNetCore.SpaServices.Xsrf&version=10.2.0
                    
Install as a Cake Addin
#tool nuget:?package=MintPlayer.AspNetCore.SpaServices.Xsrf&version=10.2.0
                    
Install as a Cake Tool

MintPlayer.AspNetCore.SpaServices.Xsrf

NuGet Version NuGet License

This package provides ASP.NET Core middleware for managing CSRF (Cross-Site Request Forgery) protection in single-page applications.

Installation

NuGet Package Manager

Install-Package MintPlayer.AspNetCore.SpaServices.Xsrf

.NET CLI

dotnet add package MintPlayer.AspNetCore.SpaServices.Xsrf

Features

  • Automatic XSRF token generation and validation
  • Cookie-based token storage compatible with SPA frameworks
  • Seamless integration with Angular's built-in XSRF handling
  • Support for custom header and cookie names

Usage

1. Add Services

public void ConfigureServices(IServiceCollection services)
{
    services.AddAntiforgery(options =>
    {
        options.HeaderName = "X-XSRF-TOKEN";
    });
}

2. Add Middleware

public void Configure(IApplicationBuilder app)
{
    app.UseSpaXsrf();

    // ... other middleware
}

3. Angular Configuration

Angular automatically reads XSRF tokens from cookies named XSRF-TOKEN and sends them in the X-XSRF-TOKEN header. The middleware is configured to work with these defaults.

If you need custom names, configure both ASP.NET Core and Angular accordingly:

// ASP.NET Core
services.AddAntiforgery(options =>
{
    options.HeaderName = "X-CUSTOM-XSRF";
    options.Cookie.Name = "CUSTOM-XSRF-TOKEN";
});
// Angular (app.module.ts)
@NgModule({
    imports: [
        HttpClientXsrfModule.withOptions({
            cookieName: 'CUSTOM-XSRF-TOKEN',
            headerName: 'X-CUSTOM-XSRF'
        })
    ]
})

License

This project is licensed under the Apache 2.0 License.

Product Compatible and additional computed target framework versions.
.NET 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 (1)

Showing the top 1 NuGet packages that depend on MintPlayer.AspNetCore.SpaServices.Xsrf:

Package Downloads
MintPlayer.Spark

Low-code .NET framework for building data-driven web applications with minimal boilerplate. Uses PersistentObject pattern to eliminate DTOs and repository layers.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
11.0.0 821 11/16/2026
11.0.0-rc.6 59 11/13/2026
11.0.0-rc.5 63 11/7/2026
11.0.0-rc.4 69 10/24/2026
11.0.0-rc.3 1,885 10/4/2026
11.0.0-rc.2 79 9/24/2026
11.0.0-rc.1 79 9/17/2026
10.8.1 86 11/13/2026
10.7.1 165 9/5/2026
10.7.0 130 9/3/2026
10.2.2 137 8/27/2026
10.2.1 220 1/19/2026
10.2.0 177 1/18/2026
10.1.0 178 1/16/2026
10.0.0 386 11/13/2025
10.0.0-rc.6 290 11/11/2025
10.0.0-rc.5 285 11/11/2025
10.0.0-rc.4 205 11/5/2025
10.0.0-rc.1 185 10/2/2025
9.0.0 282 11/13/2024
Loading failed