@using KWWebInvApp.Data @using KWWebInvApp.Services; @inject NavigationManager navigationManager @inject AuthenticationStateProvider AuthenticationStateProvider @code { protected override async Task OnInitializedAsync() { //var returnUrl = Navigation.ToBaseRelativePath(Navigation.Uri); //if (string.IsNullOrWhiteSpace(returnUrl)) // Navigation.NavigateTo("/userlogin", true); //else //{ // if (returnUrl == "userlogin") // Navigation.NavigateTo("/userlogin", true); // else // Navigation.NavigateTo($"/userlogin?returnUrl={returnUrl}", true); //} } protected override void OnAfterRender(bool firstRender) { base.OnAfterRender(firstRender); var returnUrl = navigationManager.ToBaseRelativePath(navigationManager.Uri); if (string.IsNullOrWhiteSpace(returnUrl)) navigationManager.NavigateTo("/userlogin", true); else navigationManager.NavigateTo($"/userlogin?returnUrl={returnUrl}", true); } }