如何阅读MVC OWIN AuthenticationProperties?

nik*_*nik 19 .net c# asp.net-mvc owin

在签署用户时我正在设置IsPersistent,如何读取该值?

var identity = await UserManager.CreateIdentityAsync(appUser, DefaultAuthenticationTypes.ApplicationCookie);
HttpContext.GetOwinContext().Authentication.SignIn(new AuthenticationProperties() { IsPersistent = false }, identity);
Run Code Online (Sandbox Code Playgroud)

Ram*_*are 0

由于没有太多描述,我不确定上下文。无论如何,当您对当前请求执行身份验证时,您可以获得AuthenticationProperties登录调用中提供的所有内容。代码将是..

AuthenticateResult authenticateResult = await HttpContext.GetOwinContext().Authentication.AuthenticateAsync(DefaultAuthenticationTypes.ApplicationCookie);

AuthenticationProperties yourAuthenticationProperties = authenticateResult.Properties;
Run Code Online (Sandbox Code Playgroud)