Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

How do I route in client-side blazor with a string route parameter containing dots (.)?

$
0
0

Hi there stackoverflow!

I am using Client side Blazor and have stumbled upon a tricky section regards to routing with strings and dots (.). I wish to route from an admin control page to a page with the following route: @page "/ManageGradingExamResults/{StudentEmail}". I tested such with this request: https://localhost/ManageGradingExamResults/1234@high.school.nz, but I get a not found. If I change the razor route to @page "/ManageGradingExamResults/{*StudentEmail}" I end up with the following exception: System.InvalidOperationException: Invalid template 'ManageGradingExamResults/{*StudentEmail}'. The character '*' in parameter segment '{*StudentEmail}' is not allowed.. I tried that due to the similarities in cshtml pages.

I have found that I can route with integers but have had no luck with strings. I also have come across this Microsoft doc explaining rout params and suggesting the ** in my page route. This allows me into my page however i then need to use the ? before my email in the request, the page does not load with my data as I can see it did not pull the parameter into my variable. Any suggestions or help with routing in client side Blazor would be greatly appreciated!

Request Code:

NavigationManager.NavigateTo($"/ManageGradingExamResults/?{student.Email}");

Request URL:

https://localhost/ManageGradingExamResults/?1234@high.school.nz

Razor page route:

@page "/**ManageGradingExamResults/{StudentEmail}"@page "/ManageGradingExamResults"

My Variable:

@code{    [Parameter]    public string StudentEmail { get; set; }...

Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>