0

I have .net 9 web app mixing Blazor, Razor and MVC pages. When I use URL with two segments, the InteractiveServer is not working.

Following code displays: Server | true

@page "/blazor"
@rendermode InteractiveServer
<h3>TestPage</h3>
@RendererInfo.Name | @RendererInfo.IsInteractive
@code {}

But when I change the page directive to:

@page "/blazor/test"
[the rest the same]

It displays: Static | false.

I suppose some routing conflicts but have not found any solution for it. Any hints?

This is part of my Program.cs

app.MapRazorComponents<App>()
    .AddInteractiveServerRenderMode();

app.MapControllerRoute(
   name: "default",
   pattern: "{controller=Start}/{action=Index}");

app.MapControllers();
app.MapRazorPages();

And this is just basic router in App.razor:

<Router AppAssembly="@typeof(Program).Assembly">
<Found Context="routeData">
<AuthorizeRouteView RouteData="routeData" DefaultLayout="typeof(Layout.MainLayout)" />
</Found>
<NotFound>
<p>Not found.</p>
</NotFound>
</Router>

Just in case also folder structure:

Program.cs
Components
 App.razor
 _Imports.razor
 Pages
  Test
   TestPage.razor

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.