ApricotFramework.AspNetCore.Extensions 0.1.0

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

ApricotFramework.AspNetCore.Extensions

NuGet CI License

General-purpose ASP.NET Core extensions: streaming multipart uploads, query-string-aware routing, and one-line setup for CORS, forwarded headers and cookie policy.

No package dependencies — just a FrameworkReference to Microsoft.AspNetCore.App.

Install

dotnet add package ApricotFramework.AspNetCore.Extensions

Usage

using ApricotFramework.AspNetCore.Extensions.Cors;
using ApricotFramework.AspNetCore.Extensions.Forwarding;

builder.Services.AddAnyOriginCors();
builder.Services.AddForwardingConfiguration();

app.UseForwardedHeaders();
app.UseCors(CorsExtensions.DefaultPolicyName);

Read an upload without buffering it. Each file is handed over as it arrives, so memory use does not grow with the request — 1 GB costs no more than 1 MB:

using ApricotFramework.AspNetCore.Extensions.ModelBinding;
using ApricotFramework.AspNetCore.Extensions.Uploads;

[HttpPost("upload")]
[DisableFormValueModelBinding]                  // or MVC reads the body first and leaves nothing
public async Task<IActionResult> Upload(CancellationToken cancellationToken)
{
    var fields = await this.Request.StreamFilesAsync(
        file => blobStore.WriteAsync(file.FileName, file.OpenReadStream(), cancellationToken),
        cancellationToken);

    return this.Ok(new { Title = fields["title"].ToString() });
}

This library sets no size limit, but Kestrel caps a request body at 30 MB by default and answers 413 above it. Raise it in code — Limits is not read from the Kestrel configuration section, so setting it in appsettings.json is silently ignored:

builder.WebHost.ConfigureKestrel(o => o.Limits.MaxRequestBodySize = 2048L * 1024 * 1024);

Note that AddForwardingConfiguration trusts X-Forwarded-* from any peer, because a proxy's address is rarely knowable up front. That is safe only while the application cannot be reached except through the proxy — anything able to connect directly can otherwise choose its own apparent IP address, scheme and host. Pass a callback to name the real proxies where the deployment allows it.

Full documentation: https://projectapricot.dev

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.
  • net10.0

    • No dependencies.

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
0.1.0 183 8/13/2026