I have a .NET 9 Blazor server side application. In the layout file I have a <NavLink>
that points to my login page. The login page is not a razor page, but a mapped Controller ([ApiController]
with [Route]
).
If I disable prerendering on a page, using @rendermode @(new InteractiveServerRenderMode(prerender:false))
, I can see that i.e. OnInitialized()
is called only once when accessing that page.
But when I click the login link from that page the controller is called twice (I can also see two request in devtools in the browser). I assume this is because of prerendering, but this has been disabled, so something else must be at work here.
Why is a link to my controller called twice?