我正在使用wcf服务进行身份验证和与数据库的通信。成功验证后,在客户端Web应用程序中,我尝试使用以下代码为登录用户设置Identity。
private async Task SignIn(ApplicationUser user)
{
var identity = await UserManager.CreateIdentityAsync(
user, DefaultAuthenticationTypes.ApplicationCookie);
GetAuthenticationManager().SignIn(identity);
}
private IAuthenticationManager GetAuthenticationManager()
{
var ctx = Request.GetOwinContext();
return ctx.Authentication;
}
即使在执行上述代码之后,即设置标识Request.IsAuthenticated仍然返回false。
我发现上面的代码在使用Microsoft.AspNet.Identity.Core版本1.0.0库的在线sample中运行良好。
知道我做错了吗?