AspNetCore.Docs icon indicating copy to clipboard operation
AspNetCore.Docs copied to clipboard

ArgumentException: The path in 'value' must start with '/'. (Parameter 'value')

Open knilecrack opened this issue 5 years ago • 0 comments

[Enter feedback here] Hello,

As I'm using some options in static files I read the docs and used: app.MapWhen(ctx => !ctx.Request.Path .StartsWithSegments("_framework/blazor.server.js"), subApp => subApp.UseStaticFiles(new StaticFileOptions() { ... })); To be precise I used this: app.MapWhen(ctx => !ctx.Request.Path.StartsWithSegments("_framework/blazor.server.js"), sub => sub.UseStaticFiles(new StaticFileOptions { OnPrepareResponse = ctx2 => { ctx2.Context.Response.Headers.Append("Cache-Control", $"must-revalidate, max-age={CacheMaxAge}"); ctx2.Context.Response.Headers.Append("Expires", DateTime.UtcNow.AddDays(1).ToString("R", CultureInfo.InvariantCulture)); } })); With configuration from docs I'm getting an error: ArgumentException: The path in 'value' must start with '/'. (Parameter 'value') adding / to StartsWithSegments("/_framework/blazor.server.js") solved the issue


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

knilecrack avatar Nov 19 '21 06:11 knilecrack