我正在开发一个带有身份登录的 .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):
Login
).
- 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 中身份登录页面的默认前端设计的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!