Abp框架Blazor UI 404未找到页面



我正在使用ABP框架blazor UI,我需要自定义404未找到的页面,我该怎么做?

您需要覆盖Volo.BasicThemesrcVolo.Abp.AspNetCore.Components.Web.BasicThemeThemesBasicApp.razor文件

解决方案:

实现这一点的简单方法是获取BasicTheme模块的源代码abp add-module Volo.BasicTheme --with-source-code --add-to-solution-file

然后在中手动编辑文件<YourSolutionFolder>modulesVolo.BasicThemesrcVolo.Abp.AspNetCore.Components.Web.BasicThemeThemesBasicApp.razor

示例:

@using Microsoft.Extensions.Options
@using Volo.Abp.AspNetCore.Components.Web.Theming.Routing
@inject IOptions<AbpRouterOptions> RouterOptions
<CascadingAuthenticationState>
<Router AppAssembly="RouterOptions.Value.AppAssembly"
AdditionalAssemblies="RouterOptions.Value.AdditionalAssemblies">
<Found Context="routeData">
<AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)">
<NotAuthorized>
@if (!context.User.Identity.IsAuthenticated)
{
<RedirectToLogin />
}
else
{
<p>You are not authorized to access this resource.</p>
}
</NotAuthorized>
</AuthorizeRouteView>
</Found>
<NotFound>
<LayoutView Layout="@typeof(MainLayout)">
*** <p>New not found Page Content.</p> ***
</LayoutView>
</NotFound>
</Router>
</CascadingAuthenticationState>

相关内容

  • 没有找到相关文章

最新更新