asp.net - 在.NET Core中更新身份登录页面的默认前端设计

标签 asp.net asp.net-core .net-core asp.net-core-mvc materialize

我正在开发一个使用身份登录的.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/

相关文章:

asp.net - 如何验证一个站点上的用户并将凭据传递给其他站点? (Windows 身份验证、ASP.Net)

asp.net - 在 IIS 中运行并连接到 Visual Studio Online 时,TFS API 在 ASP.NET MVC 应用程序中不起作用

asp.net - 现在开始 ASP.NET 5 Web 项目是否太早?

c# - CSOM 在线共享点出现问题

c# - 替换 NetCore 1.0 中的 Array.ConvertAll

asp.net - SSL 重定向/重写

c# - 将数据库数据绑定(bind)到 ASP.Net 中的 GridView

c# - 使用一个连接发送并发 SignalR 消息

visual-studio - 从命令行在Visual Studio 2015 Web项目中使用npm

c# - 无法在 docker 容器内访问带有 dotnet/angular spa 应用程序的 API,但可以在 docker 容器外访问