-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Description
Blazor: Routing paths with dots not working
Routing with URLs that contain dots doesn't work as documented. * character is not allowed in routing template
According to Asp.net core documentation and blazor documentation on routing, if I want to route a url such as http://myApp/counter/hello.world I should use this template
@page "/counter/{**text}"
However, I get the following error in my WASM Blazor app
blazor.webassembly.js:1 WASM: System.InvalidOperationException: Invalid template 'counter/{**text}'. The character '*' in parameter segment '{**text}' is not allowed.
The behaviour is clearly caused by the following line in the framework
https://github.com/aspnet/AspNetCore/blob/master/src/Components/Components/src/Routing/TemplateParser.cs#L74
So this suggests the documentation is not correct
To Reproduce
Modify the Counter.razor.cs included in the template blazor wasm
Change the routing to the example above
In a browser, navigate to the local web app with url http://myapp/counter/hello.world
Look at the browser's console: the error mentioned before is shown. the path is not routed
Further technical details
- ASP.NET Core version: 3.1.100-preview2-014569 [/usr/local/share/dotnet/sdk]
- Browser: CHrome Version 78.0.3904.108 (Official Build) (64-bit)
- The IDE (VS4Mac)
Version: 1.40.1
Commit: 8795a9889db74563ddd43eb0a897a2384129a619
Date: 2019-11-13T16:47:44.719Z
Electron: 6.1.2
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Darwin x64 18.0.0