Hello how can you redirect to another page in Blazor with a parameter?
@page \"/auth\"
@using Microsoft.AspNetCore.Blazor.Services;
@inject Auth
Do this:
@page "/home"
@page "/home/{username}"
@Username is authenticated!
@functions {
// Define a property to contain the parameter passed from the auth page
[Parameter]
private string Username { get; set; };
}
@functions{
public string Username { get; set; }
public string url = "/home";
public async Task AuthAsync()
{
var ticket=await this.auth.AuthenticateAsync(Username);
// Attach the parameter to the url
urihelper.NavigateTo(url + "/" + Username);
}
}
Hope this helps...