Search code examples
blazorblazor-webassembly

How can I turn off automatic checking loging state in blazor?


I am currently working my way through Blazor in Visual Studio and I have a Blazor Webassembly App project running .NET 5.0 with ASP.NET Core hosted, Configured for HTTPS and with the Authentication Type set to Individual accounts. I am currently deep into the project and I am trying to create a dynamic UI which is based off whether the user is logged in or not. Note: I have not changed anything to do with the autorization or authentication.

Now the problem I am having is whenever I access one of my pages it automatically takes me to the loging page via the message "Checking login state ...". Now obviously I want to remove this if possible and let the user decide if he wishes to log in to see more content. I have read some documentation and played aroun wit the @attribute [Authorize] and the @attribute [AllowAnonymous] but for some reason it still bypasses the anonymous attribute. I have also played around with the <AuthorizeView>, <Authorized> and <NotAuthorized> but it doesn't even get to that point as it overrides everything.

If anyone could point me in the right direction or something because I am at a loss with this and dont know what to do anymore.


Solution

  • Do all pages take you to the Log In page? Without seeing the code, remove all the authorization stuff and get back to the page loading, then step through adding in the authorization.