2011-04-27 49 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