【发布时间】:2014-07-23 00:43:35
【问题描述】:
我在用户登录时设置 IsPersistent,如何读回该值?
var identity = await UserManager.CreateIdentityAsync(appUser, DefaultAuthenticationTypes.ApplicationCookie);
HttpContext.GetOwinContext().Authentication.SignIn(new AuthenticationProperties() { IsPersistent = false }, identity);
【问题讨论】:
-
@MarioDS,这个问题没有得到关注是有原因的。因为它不是很清楚。但抛开这一点,您应该首先了解该属性的含义。检查此答案stackoverflow.com/a/32052308/5233410 简而言之,它(属性)不会存储以供回读。它只是指示框架创建一个 cookie。所以我的假设是,一旦 cookie 存在,那么该属性可能设置为 true,否则为 false。
-
@Nkosi 我意识到在我设置赏金后不久 - 不幸的是没有回头:)。我真正想知道的是如何读回其他属性(尤其是在AuthenticationProperties的“字典”中设置的那些)。
-
也许这个链接会对你有所帮助。 stackoverflow.com/questions/31946582/…
-
@nik 你使用哪种身份验证??
-
您能否详细解释一下您想在视图中读取身份验证道具的位置、其他控制器等??
标签: c# .net asp.net-mvc owin