Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

How to fix global authorization in Blazor breaking CSS?

$
0
0

I added global authorization to a Blazor server application using this code in Program.cs:

builder.Services.AddAuthorization(options =>{    options.FallbackPolicy = options.DefaultPolicy;});

It works well. This also gives me the option disable authorization on a specific page by adding @attribute [AllowAnonymous] to it. I added the attribute to the sign-in page which looks like so:

enter image description here

However, without any errors in the console, the page's styling always breaks if I visit it incognito:

enter image description here

But the moment I sign in, every page's styling works again.

This behavior is leading me to believe that global authorization prevents the app from retrieving styling files, but I don't know how to fix that.

One way of fixing it that worked was to remove global authorization and authorize only the pages that need it. However, I like the global approach better because then during development I don't need to worry about forgetting to authorize a page.

How can I keep global authorization and fix this issue with page styling?


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>