【发布时间】:2016-01-07 23:41:48
【问题描述】:
我们正在尝试使用 ASP.NET 5 Web 应用程序模板将 Microsoft 身份验证引入我们的应用程序。
默认模板将用户从_LoginPartial.cshtml 中的登录链接带到他们选择首选身份验证提供程序的登录页面。我们只想接受 Microsoft 身份验证,因此我们希望 _LoginPartial.cshtml 让用户登录。
我修改了_LoginPartial.cshtml
<ul class="nav navbar-nav navbar-right">
@*<li><a asp-controller="Account" asp-action="Register">Register</a></li>*@
<li><a asp-controller="Account" asp-action="ExternalLogin">Log in</a></li>
</ul>
我也改了AccountController ExternalLogin的provider参数
public IActionResult ExternalLogin(string provider="Microsoft", string returnUrl = null)
{
// Request a redirect to the external login provider.
var redirectUrl = Url.Action("ExternalLoginCallback", "Account", new { ReturnUrl = returnUrl });
var properties = _signInManager.ConfigureExternalAuthenticationProperties(provider, redirectUrl);
return new ChallengeResult(provider, properties);
}
但在我的情况下,ExternalLogin 没有被调用并且是一个空白页
http://localhost:52711/Account/ExternalLogin 被返回。
我做错了什么?
【问题讨论】:
标签: asp.net-core asp.net-core-mvc entity-framework-core asp.net-identity-3