问题描述
我正在开发一个带有身份登录的 .NET 核心应用程序,它在/Identity/Account/Login 页面中提供了一个引导表单.
I am developing a .NET core application with Identity login which provides a Bootstrap form In the /Identity/Account/Login page.
我已在 wwwroot/lib 文件夹中导入 Materialize CSS 文件,并想更改登录页面的设计也使用了materialize 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 中,右键单击项目 > 添加 > 新建脚手架项目.
- 在添加脚手架对话框的左侧窗格中,选择Identity > ADD.
- 在 ADD Identity 对话框中,选择所需的选项(在您的情况下为
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
用于 Razor 页面~/Views/Shared/_Layout.cshtml
用于 MVC 项目For example
~/Pages/Shared/_Layout.cshtml
for Razor Pages~/Views/Shared/_Layout.cshtml
for MVC projects- 要使用现有数据上下文,请选择至少一个要覆盖的文件.您必须至少选择一个文件来添加数据上下文.
- 选择您的数据上下文类.
- 选择添加.
- 选择 + 按钮以创建新的数据上下文类.
- 选择添加.
注意:如果您要创建新的用户上下文,则不必选择要覆盖的文件.
Note: If you're creating a new user context, you don't have to select a file to override.
另一种方法是查看 登录页面源代码 并查看 HTML 元素的 id 和类.然后,您可以通过编写比默认 CSS 更具体的 CSS 来覆盖默认 CSS.
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 中身份登录页面的默认前端设计的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!
本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!