dotnet / dotnet/aspnetcore

Blazor - Allow hashed routing

Open
#6,175 26 comments 74 reactions 0 assignees View on GitHub
affected-very-few area-blazor enhancement feature-blazor-builtin-components Pillar: Complete Blazor Web Priority:2 severity-minor
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 5h
Merged PRs (30d)
276

Description

Hello there.

I have just been reading [this in-depth guide](https://www.dotnetcurry.com/dotnet/1460/blazor-getting-started).
In the section **Client Routing** the article states:

> One caveat with routing is that it uses normal URLs and there is no hashed mode.
> That is, a `@page` "/counter" will be accessible at the /counter URL and there is no option to use #/counter.
> While this is something desirable in most cases, it means that the server hosting the Blazor app should be configured to redirect all URLs that don’t match a static file to the index.html file, which will then bootstrap the application in the browser and will ultimately perform the navigation.

I have recently created a Angular app that required hashed routes, as it was purely client-side, the server was a MVC controller and I did not want my client making requests to the server... only for the server to redirect to index.html... plus I found that the server had trouble deciding between component and API routes.

I think hashed routes are a very important feature, and for my previous project they where a necessity.

Hope this is added in future.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.