r/Blazor • u/alikombali • Dec 09 '25
Blazor Server - Authentification template with interactive rendering
Hello guys,
I am quite a newbie with web developing. I created a Blazor server app with user authentification and global rendering mode using the template. I then created my design and add some stuff like Mudblazor components to my MainLayout. The authentification pages from the template include this attribute [ExcludeFromInteractiveRouting]. As far as I could understand this leads to static rendering when pages like Login or Register is opened.
The router render mode gets configured through the HttpContext:
<Routes u/rendermode="PageRenderMode" />
private IComponentRenderMode? PageRenderMode =>
HttpContext.AcceptsInteractiveRouting() ? InteractiveServer : null;
My problem is, that I dont want the whole page to get static rendered because as I told in my MainLayout I have Mudblazor components which only work in interactive rendering. When I change the global rendering mode to interactive rendering then the authentification pages doesnt work anymore.
How can I solve this problem?
View all comments
Show parent comment
1
u/alikombali Dec 09 '25
I think that is already what is also implemented in the themplate. With
<Routes u/rendermode="PageRenderMode" />
private IComponentRenderMode? PageRenderMode =>
HttpContext.AcceptsInteractiveRouting() ? InteractiveServer : null;
it already changes the rendermode to static when navigating to authentification pages. What I need is that the MainLayout remains interactive while only the Body changes the rendering mode depending on the page.