C#C
C#14mo ago
Angius

Trying to add Blazor Server to an `Area` in an existing Razor Pages app

Added
app.MapBlazorHub();
and
services.AddServerSideBlazor();

Added:
*
/Areas/Admin/Pages/_Imports.razor

*
/Areas/Admin/Pages/_Host.cshtml

*
/Areas/Admin/Pages/Shared/App.razor

Added
/Areas/Admin/Pages/Skunga.razor


Currently trying to make
Skunga
appear at
/admin/skunga
route.

// _Host.cshtml
@page "/Admin/{**segment}"
@using Ogma3.Areas.Admin.Pages.Shared

@{
    Layout = "_Layout";
}

<app>
    @(await Html.RenderComponentAsync<App>(RenderMode.Server))
</app>

<!-- App.razor -->
<Router AppAssembly="typeof(Program).Assembly">
    <Found Context="routeData">
        <RouteView RouteData="routeData"/>
    </Found>
    <NotFound>
        <h1>Page not found</h1>
        <p>Sorry, but there's nothing here!</p>
    </NotFound>
</Router>

Layout file adds
<base href="/" />
to the
head
section and imports
<script src="~/_framework/blazor.server.js"></script>

The issue is that I just get a
Page not found
message
image.png
Was this page helpful?