在.NET Core中更新身份登录页面的默认前端设计 [英] Updating default front-end design of Identity Login Page in .NET core
问题描述
我正在开发具有身份登录名的.NET核心应用程序,该应用程序在/Identity/Account/Login页面中提供了 Bootstrap表单.
I am developing a .NET core application with Identity login which provides a Bootstrap form In the /Identity/Account/Login page.
我已经在wwwroot/lib文件夹中导入了 对CSS进行材料文件,并希望更改登录页面的设计也实现了CSS.
I have imported Materialize CSS files in the wwwroot/lib folder and want to change the Login page's design with materialize css as well.
问题是/Identity/Account/Login页面在项目结构中不存在.那我该如何解决这个问题呢?
The problem is /Identity/Account/Login page doesn't exist in project structure. Then how should I approach to solve this problem?
推荐答案
One way would be to scaffold the login page, which would add it to your project structure. Then you would be able to make any changes you want. You would have to do the following (from the link I provided):
- 在 Solution Explorer 中,右键单击项目> 添加> 新脚手架项目.
- 从添加支架对话框的左窗格中,选择身份> ADD .
- 在 ADD身份对话框中,选择所需的选项(在您的情况下为
Login
).
- 选择您现有的布局页面,否则布局文件将被错误的标记覆盖.当现有的 _Layout.cshtml 文件被选中,未被覆盖.
- From Solution Explorer, right-click on the project > Add > New Scaffolded Item.
- From the left pane of the Add Scaffold dialog, select Identity > ADD.
- In the ADD Identity dialog, select the options you want (in your case
Login
).
- Select your existing layout page, or your layout file will be overwritten with incorrect markup. When an existing _Layout.cshtml file is selected, it is not overwritten.
例如剃须页的~/Pages/Shared/_Layout.cshtml
~/Views/Shared/_Layout.cshtml
用于MVC项目
For example ~/Pages/Shared/_Layout.cshtml
for Razor Pages
~/Views/Shared/_Layout.cshtml
for MVC projects
- 要使用现有数据上下文,请至少选择一个要覆盖的文件.您必须至少选择一个文件才能添加数据上下文.
- 选择数据上下文类.
- 选择 ADD .
- To use your existing data context, select at least one file to override. You must select at least one file to add your data context.
- Select your data context class.
- Select ADD.
- 选择+按钮创建一个新的数据上下文类.
- 选择 ADD .
- Select the + button to create a new Data context class.
- Select ADD.
注意:如果要创建新的用户上下文,则不必选择 一个要覆盖的文件.
Note: If you're creating a new user context, you don't have to select a file to override.
Another way would be to look at the Login page source code and see HTML elements' ids and classes. Then you could override the default CSS by writing your own CSS that would be more specific than the default one.
这篇关于在.NET Core中更新身份登录页面的默认前端设计的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!