comichael
comichael

Reputation: 460

Blazor Server: OnAfterRender not called on manual browser refresh

My Blazor server app is running in debug mode in VS 2019 on IIS Express.

I have a component, HoursRegistration.razor, with this page declaration:

@page "/hoursregistration/"
@page "/hoursregistration/{SelectedJobCardID:int}"

When I link to this page with the parameter, it is rendered as expected.

https://localhost:44380/hoursregistration/2

However, when I refresh the page using the browser refresh button, only OnInitialized is called, not OnAfterRender, and the rendering fails. This only happens when the parameter is set. Without the parameter, browser refresh works fine.

Can anyone help explaining what is going on here?

Upvotes: 0

Views: 438

Answers (1)

comichael
comichael

Reputation: 460

After some research, I found out that I had forgot to add

<base href="~/" />

to _Host.cshtml

Upvotes: 1

Related Questions