Static files can't be served from the root when a Razor page component matches that route with param #52320
Closed
1 task done
Labels
area-blazor
Includes: Blazor, Razor Components
✔️ Resolution: Answered
Resolved because the question asked by the original author has been answered.
question
Status: Resolved
Is there an existing issue for this?
Is your feature request related to a problem? Please describe the problem.
TL;DR; Static files can't be served from the root when a Razor page component matches that route.
Consider that you are building a CMS. You have Page component that is supposed to display page content, so you want to catch the "permalink" like so:
@page "/{permalink}"
That is all fine so far. The component gets hit upon navigating to: http://localhost:5000/this-is-a-test.
The problem with this path seems to have precedence over static file. So it catches all routes and paths, including static files.
Because of this static files can't be served from the root.
Describe the solution you'd like
Guidance in how to solve such a situation. Since I imagine this is a common case for larger sites to want to use not only simple parameters, but also for wildcards.
As a solution in my case, I guess that I could put resources in sub-folders in the wwwroot-folder. That would work in this instance, but not for wildcards params.
Additional context
No response
The text was updated successfully, but these errors were encountered: