我正在开发一个使用身份登录的.NET核心应用程序,该应用程序在/Identity/Account/Login页面中提供了 Bootstrap形式。
我已经将wwwroot/lib文件夹中的 Materialize CSS文件导入了,并且还希望通过实现CSS来更改“登录”页面的设计。
问题是项目结构中不存在/Identity/Account/Login页面。那我该如何解决这个问题呢?
最佳答案
一种方法是scaffold the login page,它将添加到您的项目结构中。然后,您将可以进行所需的任何更改。您将必须执行以下操作(通过我提供的链接):
- 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.
For example
~/Pages/Shared/_Layout.cshtml
for Razor Pages~/Views/Shared/_Layout.cshtml
for MVC projects
- 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.
- To create a new user context and possibly create a custom user class for Identity:
- 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.
另一种方法是查看Login page source code并查看HTML元素的ID和类。然后,您可以通过编写比默认CSS更具体的CSS来覆盖默认CSS。
关于asp.net - 在.NET Core中更新身份登录页面的默认前端设计,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55296041/