3
更新我MVC5应用程序的nuget包(到目前为止一直工作正常)用于验证用户的Facebook身份验证管理器现在总是返回null。在更新nuget后,AuthenticationManager.GetExternalLoginInfoAsync()返回null
我正在Visual Studio 2012中开发我的解决方案并使用最新的webtools。
[AllowAnonymous]
public async Task<ActionResult> ExternalLoginCallback(string returnUrl)
{
var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync();
if (loginInfo == null)
{
return RedirectToAction("Login");
}
}
围绕谷歌搜索后,我发现Facebook的API已经改变,但没有关于如何得到的NuGet pacakages与MVC5应用工作的解决方案。请任何人都可以指导我如何让这个工作再次。
我试过以下,但从Facebook返回的请求始终为空。
添加
<system.web><authentication mode="None" /></system.web>
<system.webServer><modules><remove name="FormsAuthentication" /></modules></system.webServer>
设置
HttpContext.GetOwinContext().Response.Cookies.Append("OwinCookie", "SomeValue");
HttpContext.Response.Cookies["ASPCookie"].Value = "SomeValue";
HttpContext.Response.Cookies.Remove("ASPCookie");