2011-04-27 50 views
0

早上好, 请问,我怎样才能得到匿名配置文件不是当前用户?如何为非当前用户获取匿名配置文件?

profile = (ProfileCommon)ProfileBase.Create(user.UserName); 

但是,对于匿名用户: 个人资料注册用户,我可以得到什么? (在App_Code文件类)

回答

1

感谢您的回复,但我想一定是这样,这工作的罚款:再次

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); 
} 

谢谢:)

0

不亲自喜欢内置的轮廓的东西我自己,但我相信,一旦编译,你可以使用:

Profile.GetProfile();

这并不是静态的方法中,或者使用单独的类库对于工作,我想你需要:

HttpContext.Current.Profile.GetProfile();

我不知道是否有检索匿名配置文件的选项,但您需要某种方式来识别您尝试检索哪个配置文件。

+0

http://odetocode.com/articles/440.aspx包含有关的一些信息迁移可能提供更多帮助的匿名用户。 – Mark 2011-04-27 12:19:16