Kentico GetUserDataFromAuthCookie() 返回 null
Kentico GetUserDataFromAuthCookie() returning null
我正在处理示例 K10 公司网站。
在 SignOutButton.ascx.cs 上,我将调用移至 GetUserDataFromAuthCookie()
,因此断点总是会像这样命中:
if (AuthenticationHelper.IsAuthenticated())
{
string[] userData = AuthenticationHelper.GetUserDataFromAuthCookie();
}
我确定浏览器正在存储 cookie,因为当我使用保持登录选项时,我会保持登录状态。但是,GetUserDataFromAuthCookie()
总是 returns null。
这是否仅在用户使用 WindowsLiveID 进行身份验证时有效?
干杯,
罗里
如果您看一下 the source code of SignOutButton.ascx.cs userdata available only inside condition if (!String.IsNullOrEmpty(CMSContext.CurrentUser.UserSettings.WindowsLiveID))
. The helper just calls standard asp.net method inside to get userdata property from forms authentication ticket, unless you've saved something yourself inside the authentication ticket userdata - 没有什么可得到的。我假设在使用 WindowsLiveID 时,一些信息保存在用户数据中。所有其他时间它只是空的。 UserData 是放置少量通常需要的用户信息的有用位置。除非你自己把东西放在那里,否则它是空的。
我正在处理示例 K10 公司网站。
在 SignOutButton.ascx.cs 上,我将调用移至 GetUserDataFromAuthCookie()
,因此断点总是会像这样命中:
if (AuthenticationHelper.IsAuthenticated())
{
string[] userData = AuthenticationHelper.GetUserDataFromAuthCookie();
}
我确定浏览器正在存储 cookie,因为当我使用保持登录选项时,我会保持登录状态。但是,GetUserDataFromAuthCookie()
总是 returns null。
这是否仅在用户使用 WindowsLiveID 进行身份验证时有效?
干杯,
罗里
如果您看一下 the source code of SignOutButton.ascx.cs userdata available only inside condition if (!String.IsNullOrEmpty(CMSContext.CurrentUser.UserSettings.WindowsLiveID))
. The helper just calls standard asp.net method inside to get userdata property from forms authentication ticket, unless you've saved something yourself inside the authentication ticket userdata - 没有什么可得到的。我假设在使用 WindowsLiveID 时,一些信息保存在用户数据中。所有其他时间它只是空的。 UserData 是放置少量通常需要的用户信息的有用位置。除非你自己把东西放在那里,否则它是空的。