@inject NavigationManager NavigationManager

@code {
    protected override void OnInitialized()
    {
        var relativeReturnUrl = NavigationManager.ToBaseRelativePath(NavigationManager.Uri);
        var loginUrl = $"/login?returnUrl={Uri.EscapeDataString("/" + relativeReturnUrl)}";
        NavigationManager.NavigateTo(loginUrl, forceLoad: true);
    }
}
