【发布时间】:2011-04-27 10:20:04
【问题描述】:
早上好, 请问,如何获取非当前用户的匿名个人资料? 我可以获得的注册用户个人资料:
profile = (ProfileCommon)ProfileBase.Create(user.UserName);
但是,对于匿名用户? (App_Code 中的类)
【问题讨论】:
标签: c# asp.net webforms profile
早上好, 请问,如何获取非当前用户的匿名个人资料? 我可以获得的注册用户个人资料:
profile = (ProfileCommon)ProfileBase.Create(user.UserName);
但是,对于匿名用户? (App_Code 中的类)
【问题讨论】:
标签: c# asp.net webforms profile
感谢您的回复,但我想要一些这样的,这工作正常:
user = Membership.GetUser(new Guid(item["UserID"].ToString()));
if (user == null)
{
// anonymous profile
profil = (ProfileCommon)ProfileBase.Create(item["UserID"].ToString());
}
else
{
// hey! I know you!
profil = (ProfileCommon)ProfileBase.Create(user.UserName);
}
再次感谢:)
【讨论】:
我个人不喜欢内置的配置文件,但我相信一旦编译你就可以使用:
Profile.GetProfile();
这不适用于静态方法,或者我认为您需要使用单独的类库:
HttpContext.Current.Profile.GetProfile();
我不知道是否有检索匿名个人资料的选项,因为您需要某种方式来确定您尝试检索的个人资料。
【讨论】: