@inject NavigationManager NavigationManager

<section class="panel tooling-surface">
    <h1 class="panel-title">Redirecting…</h1>
    <p class="panel-copy">This route moved to <code>@TargetPath</code>. If the redirect does not complete automatically, use the link below.</p>
    <div class="action-row">
        <a class="btn-link" href="@BuildTargetUri()">Continue</a>
    </div>
</section>

@code {
    [Parameter, EditorRequired]
    public string TargetPath { get; set; } = string.Empty;

    protected override void OnAfterRender(bool firstRender)
    {
        if (!firstRender)
        {
            return;
        }

        NavigationManager.NavigateTo(BuildTargetUri(), replace: true);
    }

    private string BuildTargetUri()
    {
        var currentUri = NavigationManager.ToAbsoluteUri(NavigationManager.Uri);
        return string.Concat(TargetPath, currentUri.Query, currentUri.Fragment);
    }
}
