Open Closed

Override App.razor in a Blazor Server application template #4796


User avatar
0
ccernat created
  • ABP Framework version: v7.1.0
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

Hello,

How can I override App.razor in a ABP Blazor Server app template?

Thank you!

Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

2 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    @using Microsoft.Extensions.Options
    @using Microsoft.Extensions.Localization
    @using global::Localization.Resources.AbpUi
    @using Volo.Abp.AspNetCore.Components.Web.LeptonTheme.Components.ApplicationLayout
    @using Volo.Abp.AspNetCore.Components.Web.Theming.Routing
    @using Volo.Abp.DependencyInjection
    @inject IOptions<AbpRouterOptions> RouterOptions
    @inject IStringLocalizer<AbpUiResource> UiLocalizer
    @inherits Volo.Abp.AspNetCore.Components.Web.LeptonTheme.Components.App
    @attribute [Dependency(ReplaceServices = true)]
    @attribute [ExposeServices(typeof(Volo.Abp.AspNetCore.Components.Web.LeptonTheme.Components.App))]
    <CascadingAuthenticationState>
        <Router AppAssembly="RouterOptions.Value.AppAssembly"
                AdditionalAssemblies="RouterOptions.Value.AdditionalAssemblies">
            <Found Context="routeData">
                <AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(DefaultLayout)">
                    <NotAuthorized>
                        @if (context.User?.Identity?.IsAuthenticated == false)
                        {
                            <RedirectToLogin/>
                        }
                        else
                        {
                            @* Temporary removed since it makes a flicker effect on page refresh *@
                            @* <ErrorView
                                Title="@UiLocalizer["403Message"]"
                                HttpStatusCode="403"
                                Message="@UiLocalizer["403MessageDetail"]"/> *@
                        }
                    </NotAuthorized>
                </AuthorizeRouteView>
            </Found>
            <NotFound>
                <LayoutView Layout="@typeof(DefaultLayout)">
                    <Volo.Abp.AspNetCore.Components.Web.LeptonTheme.Components.ErrorView
                        Title="@UiLocalizer["404Message"]"
                        HttpStatusCode="404"
                        Message="@UiLocalizer["404MessageDetail"]"/>
    
                    <h1>test222</h1>
                </LayoutView>
            </NotFound>
        </Router>
    </CascadingAuthenticationState>
    
    

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    ccernat created

    tks a lot!

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on September 28, 2026, 11:44
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.