IronLoon.AspNetCore.PathBaseNormalizer
1.0.0
dotnet add package IronLoon.AspNetCore.PathBaseNormalizer --version 1.0.0
NuGet\Install-Package IronLoon.AspNetCore.PathBaseNormalizer -Version 1.0.0
<PackageReference Include="IronLoon.AspNetCore.PathBaseNormalizer" Version="1.0.0" />
<PackageVersion Include="IronLoon.AspNetCore.PathBaseNormalizer" Version="1.0.0" />
<PackageReference Include="IronLoon.AspNetCore.PathBaseNormalizer" />
paket add IronLoon.AspNetCore.PathBaseNormalizer --version 1.0.0
#r "nuget: IronLoon.AspNetCore.PathBaseNormalizer, 1.0.0"
#:package IronLoon.AspNetCore.PathBaseNormalizer@1.0.0
#addin nuget:?package=IronLoon.AspNetCore.PathBaseNormalizer&version=1.0.0
#tool nuget:?package=IronLoon.AspNetCore.PathBaseNormalizer&version=1.0.0
AspNetCore.PathBaseNormalizer
ASP.NET Core middleware that normalizes PathBase casing with a 301 redirect.
When ASP.NET Core apps run behind IIS as virtual applications, users can type the URL in any casing (e.g. /myapp instead of /MyApp). IIS matches case-insensitively and passes the request through with the user's original casing in Request.PathBase. This causes problems because:
- OIDC redirect URIs registered in Azure AD / Entra ID are case-sensitive
- Cookie paths are case-sensitive in browsers
- Auth cookies set under
/myappwon't be sent for requests to/MyApp
This middleware fixes the issue by redirecting to the canonical casing before any auth middleware runs.
Installation
dotnet add package IronLoon.AspNetCore.PathBaseNormalizer
Usage
Register the middleware before authentication, authorization, and static file middleware:
var app = builder.Build();
// Must be first middleware — redirects before auth cookies are evaluated
app.UsePathBaseNormalization("/MyApp");
app.UseAuthentication();
app.UseAuthorization();
// ...
If the user requests https://host/myapp/page, they get a 301 Moved Permanently redirect to https://host/MyApp/page.
Requests with the correct casing pass through with zero overhead (a single ordinal string comparison).
Multi-segment paths
Works with nested virtual app paths:
app.UsePathBaseNormalization("/Org/MyApp");
How it works
- Compares
Request.PathBaseagainst the canonical value (case-insensitive) - If it matches but the casing differs, issues a
301 Moved Permanentlyredirect with the corrected PathBase - If it matches exactly or doesn't match at all, passes through to the next middleware
Requirements
- .NET 8.0 or .NET 10.0
- ASP.NET Core
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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 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. |
-
net10.0
- No dependencies.
-
net8.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 |
|---|---|---|
| 1.0.0 | 145 | 4/7/2026 |