ASP.NET Core MVC 2.2 无需外部登录提供程序即可登录

juF*_*uFo 7 c# asp.net-core-mvc asp.net-core-identity

如何仅使用默认本地登录而不使用外部登录提供程序来配置 asp.net core mvc 2.2?

我似乎找不到删除它的方法:

Use another service to log in.

There are no external authentication services configured. See this article for details on setting up this ASP.NET application to support logging in via external services. 
Run Code Online (Sandbox Code Playgroud)

我现在只想使用本地帐户(也许稍后会添加外部提供商)。

      services.AddIdentity<ApplicationUser, ApplicationRole>()
        .AddEntityFrameworkStores<ApplicationDbContext>()
        .AddDefaultTokenProviders()
        .AddDefaultUI(UIFramework.Bootstrap4);
Run Code Online (Sandbox Code Playgroud)

Mar*_*pic 6

这是不可配置的。如果您查看登录页面的实现,您会发现它没有使用任何选项,而只是呈现消息。

使用其他服务登录。

总是被渲染并且

没有配置外部身份验证服务。有关设置此 ASP.NET 应用程序以支持通过外部服务登录的详细信息,请参阅本文。

如果没有外部登录提供程序,则会呈现。

无法使用身份生成器或类似的东西删除消息。唯一的方法是构建登录页面(正如Kirk Larkin指出的那样)并从文件中删除消息Login.cshtml

  • 这是我一直在寻找的答案,但我想指出,这是微软提供的一个非常糟糕的解决方案。没有人会希望在生产中使用它,这基本上使得即使是最简单的应用程序在没有脚手架的情况下也毫无用处。 (10认同)