I have a blazor application with areas like this :
I need a custom _Host.cshtml for each area, with custom javascript, css etc...
I have try using multiples MapFallbackToPage and MapFallbackToAreaPage, but none work ! And I can't find such sample anywhere !
Any idea to solve this, I have a few questions:
1) Should I use MapFallbackToPage or MapFallbackToAreaPage and how ? 2) in _HostAdmin.cshtml should I have
PS: I have try to request MS help, but without a chance: https://github.com/dotnet/aspnetcore/issues/21574
Solution for file structure
Page /admin/admin and /admin/admin/123 - other use default scheme
endpoints.MapControllers();
endpoints.MapBlazorHub();
endpoints.MapFallbackToAreaPage("/Admin/admin", "/_HostAdmin", "Admin");
endpoints.MapFallbackToAreaPage("/Admin/admin/{Id:long}", "/_HostAdmin", "Admin");
endpoints.MapFallbackToPage("/_Host");
or for all pages in /Admin/
endpoints.MapControllers();
endpoints.MapBlazorHub();
endpoints.MapFallbackToAreaPage("/Admin/{*clientroutes:nonfile}", "/_HostAdmin", "Admin");
endpoints.MapFallbackToPage("/_Host");
_hostAdmin.cshtml
@page "/admin/"
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@{
Layout = "_layoutAdministration";
}
<component type="typeof(AdminApp)" render-mode="ServerPrerendered" />
<div id="blazor-error-ui">
<environment include="Staging,Production">
An error has occurred. This application may no longer respond until reloaded.
</environment>
<environment include="Development">
An unhandled exception has occurred. See browser dev tools for details.
</environment>
<a href="" class="reload">Reload</a>
<a class="dismiss">🗙</a>
</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With