BlazorWebAppEntra .net9 sample app resets back to Home page

Saeed Dudhia 0 Reputation points
2025-03-23T10:41:07.2666667+00:00

Download the BlazorWebAppEntra .net9 sample and create the app in Azure Entra with the other setup that you need to do in Azure. When you are able to login using Azure Entra into you Blazor Web App login click the Weather link in the Nav bar. You will briefly get the Weather page displayed but then immeditely you are taken back to the home page.

Blazor Training
Blazor Training
Blazor: A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.Training: Instruction to develop new skills.
31 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Pradeep M 8,185 Reputation points Microsoft External Staff
    2025-03-24T09:58:36.8666667+00:00

    Hi Saeed Dudhia

    Thank you for reaching out to Microsoft Q & A forum. 

    The issue where the Blazor Web App returns to the home page after clicking the Weather link is likely due to an authentication or authorization misconfiguration. Here are a few things to check: 

    1.Authentication Token: Ensure the app retains the login token by checking browser storage. 

    2.Authorization Settings: If the Weather page requires authorization, verify that the user has the correct roles and permissions in Azure Entra ID. 

    3.Redirect URI Configuration: Confirm that the redirect URIs in Azure Entra ID match those in appsettings.json. 

    4.Navigation Behavior: Check if any code is unintentionally redirecting users back to the home page. 

    5.API Permissions: If the Weather page loads data from an API, make sure the required permissions are granted in Azure Entra ID. 

    To troubleshoot, try accessing the page without authentication and check the browser console logs for any errors.     

    If you have found the answer provided to be helpful, please click on the "Accept answer/Upvote" button so that it is useful for other members in the Microsoft Q&A community.  

    0 comments No comments

  2. Saeed Dudhia 0 Reputation points
    2025-03-24T12:11:34.4233333+00:00

    There is no problem with my being able to log-in or anyone of the following:

    1. Authentication Token: This is the Sample app provided by Microsoft as mentioned. No code changed from example app.
    2. Authorization Settings: I am able to login as I have correctly followed the notes and created the app in Azure Entra.
    3. Redirect URI Configuration: No code changed from example app.
    4. Navigation Behavior: No code changed from example app.
    5. API Permissions: I am able to login and eventually see the data in the Weather page.

    The problem is - after I log-in, I am able to click the Weather page and I briefly get to see the Weather data and then the app reverts back to the Home page automatically. When I click the Weather page again I do get to see the data again. The example is really clunky and not smooth. How do I know when all the setup after logging-in is completed before I can safely click the Weather link and it does not revert back to the Home page? If you hover over the links you will see that after logging in there comes a point where the hover over the links starts to work. At this point I am able to click the Weather link safely without it transferring me back to the home page. It would be nice if I can disable the links until the logging in process is thoroughly completed.


  3. Saeed Dudhia 0 Reputation points
    2025-03-25T08:34:34.6166667+00:00

    Hi Pradeep - you could have just googled BlazorWebAppEntra but in any case here is the link to the actual Blazor App in your repository:
    https://github.com/dotnet/blazor-samples/tree/main/9.0/BlazorWebAppEntra


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.