Hello ABP Support Team,
I am currently trying to completely customize the UI of the default login page for my application, but I am running into some architectural/compilation issues.
Here is my current setup:
UI Framework: Blazor Server
Architecture: Monolithic (I do not have a separate .AuthServer project; everything is unified in my Axialease.Extranet.Blazor project).
My Goal: I want to override the default Razor Page for the login (Login.cshtml) to create a custom split-screen design, while keeping the default C# code-behind logic (LoginModel).
What I've Tried: I have already searched the official documentation and support forums for existing solutions. However, every example and solution I found assumes the presence of a separate .AuthServer project, which does not apply to my monolithic architecture.
2 Answer(s)
-
0
- In a Blazor Server (monolithic / no separate AuthServer) solution, the login UI is still an MVC/Razor Page coming from
Volo.Abp.Account.Web. So you override it the same way: add a Razor Page with the same path in the host project that actually serves MVC endpoints (in most ABP Blazor Server solutions this is*.HttpApi.Host, not the*.Blazorproject).
Create the overriding Razor Page
- In your host project (the one that has
app.UseConfiguredEndpoints()and serves/Account/Login):- Create folder:
Pages/Account - Add file:
Pages/Account/Login.cshtml
- Create folder:
- In your host project (the one that has
Keep ABP’s logic by deriving from the built-in
LoginModel- Add a PageModel (e.g.
CustomLoginModel) that inherits from ABP’sLoginModeland only calls the base constructor (so you keep default behavior). - Example:
- Add a PageModel (e.g.
using Microsoft.AspNetCore.Authentication; using Microsoft.Extensions.Options; using Volo.Abp.Account.Web; using Volo.Abp.Account.Web.Pages.Account; namespace YourCompany.YourApp.HttpApi.Host.Pages.Account; public class CustomLoginModel : LoginModel { public CustomLoginModel( IAuthenticationSchemeProvider schemeProvider, IOptions<AbpAccountOptions> accountOptions) : base(schemeProvider, accountOptions) { } }- Point the view to your derived model and implement your split-screen UI
- In
Pages/Account/Login.cshtml, set:
- In
@page @model YourCompany.YourApp.HttpApi.Host.Pages.Account.CustomLoginModel- Then you can fully replace the markup with your split-screen design while still using:
Model.LoginInput.UserNameOrEmailAddressModel.LoginInput.PasswordModel.ReturnUrl,Model.ReturnUrlHashModel.EnableLocalLogin,Model.VisibleExternalProviders, etc.
- If tag helpers/bundles don’t work, add
_ViewImports.cshtml- In
PagesorPages/Account, add_ViewImports.cshtml(if you don’t already have it):
- In
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers @addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI @addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap @addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bundling- Important note for “monolithic”
- Even if you consider the solution monolithic, ABP’s Blazor Server template typically still separates the UI project (
*.Blazor) from the server/host project (*.HttpApi.Host). - The login page override must be placed in the project that actually hosts MVC/Razor Pages endpoints (again, usually
*.HttpApi.Host). PuttingPages/Account/Login.cshtmlinto the*.Blazorproject commonly won’t affect/Account/Login.
- Even if you consider the solution monolithic, ABP’s Blazor Server template typically still separates the UI project (
- https://abp.io/docs/latest/framework/ui/mvc-razor-pages/customization-user-interface
This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.
- In a Blazor Server (monolithic / no separate AuthServer) solution, the login UI is still an MVC/Razor Page coming from
-
0
hi
https://abp.io/support/questions/240/How-to-customize-the-MVC-login-page https://abp.io/community/articles/how-to-customize-the-login-page-for-mvc-razor-page-applications-9a40f3cd
You can download the account pro module source code. And override the login page.
If you have openiddict, the login page base class is
OpenIddictSupportedLoginModel[ExposeServices(typeof(LoginModel))] public class OpenIddictSupportedLoginModel: LoginModelhttps://abp.io/support/questions/632/How-can-I-download-the-source-code-of-the-framework-Angular-packages-theme-and-pro-modules
https://abp.io/support/questions/160/How-to-customize-an-ABP-project