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

401 error when manually typing urls, or refreshing pages after upgrading from .net 7 to .net 8 in my Hosted Blazor WASM app

$
0
0

I have a Hosted Blazor WebAssembly app that was initially written in .net 7. I recently decided to upgrade it to .net 8 and I followed these instructions here:

https://learn.microsoft.com/en-us/aspnet/core/migration/70-80?view=aspnetcore-7.0&tabs=visual-studio#update-a-blazor-server-app

It all worked nicely and my app is working now using .net 8. However I have discovered that if a user refreshes the page, or if they manually navigate to a link (either by typing it out manually, or by clicking on one that has been sent to them) then the app immediately fails with the error:

This page isn’t workingIf the problem continues, contact the site owner.HTTP ERROR 401

Previously, it would reload the app and then show the page (as long as the user was logged in and had the correct Roles).

After doing some investigation it seems that the problem is isolated to pages that contain the Authorize attribute. For example, I have a page with the url 'localhost:7039/jobs', and at the top of it I have this:

@attribute [Authorize(Roles = "ViewJobs,EditJobs")]

If I remove that line then the problem goes away, but doing this obviously isn't a solution.

Does anyone know what might be causing this problem?


Viewing all articles
Browse latest Browse all 4839

Trending Articles



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