Blazor WASM client index.html without MainLayout

222 views Asked by At

Blazor WASM client application deploys to Azure Static Web App and displays the index.html without any of the Shared pages or MainLayout. There is allowannoymous attribute applied to page and project works well in development localhost.

Tried to remove the authorization from the index.html page. Provided an update information label to verify that all code changes are applying to deployment. Inspected the developer tools and have zero css errors with only one error to ./wellknown/ path for oidc authentication.

1

There are 1 answers

2
Tiny Wang On BEST ANSWER

I didn't reproduce your issue in my side and pls allow me share what I test here.

Firstly, I create a blazor webassembly project with Microsoft identity platform without asp.net core hosted. Because you didn't mention the authentication scheme you used.

enter image description here

After modify the properties related to Azure AD in appsettings.json in wwwroot folder, I'm able to have the sign in option in the layout. Then no matter added @attribute [Authorize] in the index.razor or in the MainLayout.razor, the app and the authentication both worked well, if I had @attribute [Authorize] in the index.razor, the app would redirect to the sign in page automatically when I hit the home page.

Then I followed the official document to publish the app to azure static website. It worked as well.

enter image description here