title: Blazor redirect back to local url from external url
body: <p>I have a Blazor App where the user should do a login on an external login page (within intranet) and after login i want to redirect back to the apps main page (dashboard).
  So what i want basically is the user opens the app and clicks the login button, then the app routes to the external login page, the user enters his username and password, after the user has logged in, the dashboard(home) from my app gets loaded and shown.</p>
  <p>So i have a login button and when the user clicks it, he will be routed to &quot;login.razor&quot;.
  In &quot;login.razor&quot; i have the following code:</p>
  <pre><code>@page &quot;/login&quot;
  @inject NavigationManager NavManager
  
  @code {
      protected override async Task OnInitializedAsync()
      {
          string homeUrl = &quot;/&quot;;
  
          //First attempt:
          // This doesn't work
          //NavManager.NavigateTo($&quot;http://external.login.page?redirectUrl={homeUrl}&quot;, forceLoad: true);
  
          // Second attempt: (doesn't work either)
          // Navigate to external login
          NavManager.NavigateTo($&quot;http://external.login.page&quot;, forceLoad: true);
  
          // Navigate to Home of blazor app (this is suppose to be executed after the user has submitted the above login form)
          NavManager.NavigateTo($&quot;{homeUrl}&quot;, forceLoad: true);
      }
  }
  </code></pre>
  <p>The first attempt is not working as the server response is an error.
  Second attempt doesn't work as the app routes almost instantly to &quot;home&quot; after the login page has been loaded.</p>
  <p>Does someone has an idea how to solve this?</p>