'Add route parameter to Blazor server app's index page
I'm developing a Blazor Server app using .NET 6.0. I would like for the index page to utilize a route parameter:
@page "/{vendorId}"
@functions {
[Parameter]
public string? vendorId { get; set; }
}
So, a user navigating to https://localhost:7071/Chesters will be retrieving data for Chesters, while a user navigating to https://localhost:7071/SmokeyJoe will be retrieving data for SmokeyJoe. The problem is when the user first navigates to that URL, he must first login to be authenticated. Once he's authenticated, the page is redirected back to https://localhost:7071 where I lose the route parameter. If the authenticated user then navigates to his intended URL, everything works as expected. So, how do I keep the authentication process from wiping out the initial navigation to the preferred URL?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|