我們正在嘗試使用ASP.NET 5 Web應用程序模板將Microsoft身份驗證引入我們的應用程序。快捷方式Microsoft身份驗證
默認模板將用戶從_LoginPartial.cshtml
的登錄鏈接轉到登錄頁面,在那裏他們選擇他們的首選身份驗證提供程序。我們只希望接受微軟認證,所以我們要_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
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
被返回。
我在做什麼錯?