ASP.NET Core Extensions
Streaming multipart uploads, query-aware routing, and one-line CORS, forwarding and cookie setup.
A small set of ASP.NET Core helpers that keep coming up: reading an upload without buffering it, requiring a query-string key at the routing layer, and the three or four lines of host configuration that every service behind a load balancer needs.
Package
| Package | What it is |
|---|---|
ApricotFramework.AspNetCore.Extensions | Everything below. One package, no dependencies. |
There is no separate core package. Every type here needs ASP.NET Core, so the library takes a
FrameworkReference to Microsoft.AspNetCore.App — which the runtime already contains, leaving no
package versions to keep in step.
Install
dotnet add package ApricotFramework.AspNetCore.ExtensionsWhat is in it
| Area | Namespace | For |
|---|---|---|
| Uploads | …Extensions.Uploads | Reading a multipart request section by section |
| Model binding | …Extensions.ModelBinding | Requiring a query key; turning form binding off |
| CORS | …Extensions.Cors | A named allow-everything policy |
| Forwarding | …Extensions.Forwarding | Honouring X-Forwarded-* behind a proxy |
| Cookies | …Extensions.Cookies | Requiring HTTPS for every cookie |
| Configuration | …Extensions.Configuration | Binding a section to a snapshot |
| HTTP | …Extensions.Http | Flattening a query; reading per-request items |
Namespaces follow the folder each type lives in, so an editor's import suggestion is enough to find anything; there is no single namespace holding all of it.
The two that carry real behaviour
Most of this library is a shortcut for something you could write inline. Two parts are not:
Uploads reads a multipart body as a stream, so a request larger than available memory costs nothing to accept. It also bounds the work a client can ask for, which the framework's own form reader does not do for every field.
Model binding makes a query-string key part of routing rather than validation,
which is how two actions on one route are told apart — and which is why a missing key answers 404
rather than 400.
Warning
AddForwardingConfiguration trusts forwarded headers from any peer. See
usage for what that means and how to narrow it.
Continue with usage, uploads or model binding.