Brad Irby
Brad Irby

Reputation: 2542

Blazor WASM page refresh cannot find CSS or js

I have a Blazor page that works fine when I navigate to it via URL links and the menu. Once on the page, though, if I hit the Chrome Refresh button I get a long list of 404 errors for all the CSS and JS files I've included. This also happens if I type in the URL to go directly to the page. The Index.razor page loads fine. A-tags and NavigationManagers also work as expected. The URL is "https://localhost:5001/OrderEdit/223821" where OrderEdit is the page name and is followed by the order number. The page directives look like this

@page "/OrderEdit"
@page "/OrderEdit/{OrderNumStr}"

When I refresh the page, I get this (cut short for brevity)

GET https://localhost:5001/OrderEdit/bootstrap/css/bootstrap.min.css?v=1 net::ERR_ABORTED 404
GET https://localhost:5001/OrderEdit/css/Chart.min.css net::ERR_ABORTED 404
GET https://localhost:5001/OrderEdit/css/app.css net::ERR_ABORTED 404
GET https://localhost:5001/OrderEdit/css/site.css net::ERR_ABORTED 404
GET https://localhost:5001/OrderEdit/bootstrap/css/custom.css?v=1 net::ERR_ABORTED 404
GET https://localhost:5001/OrderEdit/_content/Blazorise/blazorise.css net::ERR_ABORTED 404
GET https://localhost:5001/OrderEdit/_content/Blazorise.Bootstrap/blazorise.bootstrap.css net::ERR_ABORTED 404
GET https://localhost:5001/OrderEdit/_content/AntDesign/css/ant-design-blazor.css net::ERR_ABORTED 404
GET https://localhost:5001/OrderEdit/_content/Blazored.Typeahead/blazored-typeahead.css net::ERR_ABORTED 404
GET https://localhost:5001/OrderEdit/_content/BlazorDateRangePicker/daterangepicker.min.css net::ERR_ABORTED 404
GET https://localhost:5001/OrderEdit/_content/Sotsera.Blazor.Toaster/toastr.min.css net::ERR_ABORTED 404
GET https://localhost:5001/OrderEdit/_framework/blazor.webassembly.js net::ERR_ABORTED 404

Upvotes: 0

Views: 2030

Answers (1)

Mister Magoo
Mister Magoo

Reputation: 8994

Do you have a <base href="/" /> in the head of your index.html? It looks like not - as it is trying to fetch static files from /OrderEdit

Upvotes: 3

Related Questions