2012-11-15 49 views
2

我繼承了實現自定義profile提供程序的MOSS代碼。設置似乎沒問題(提供商& web.config)。爲什麼HttpContext.Current.Profile爲NULL?它如何獲得價值?

用戶可以登錄,但是登錄後,HttpContext.Current.Profile對象爲空。爲什麼它是空的?如何/何時應該獲得價值?

HttpContext.Current.User.Identity.Name在洛後的值

+0

什麼ü想做的事,並在那裏被執行的代碼? –

回答

0

嘗試ProfileBase.Create(用戶名,isAuthenticated)

 
public static System.Web.Profile.ProfileBase Create(string username, bool isAuthenticated) 
    Member of System.Web.Profile.ProfileBase 

Summary: 
Used by ASP.NET to create an instance of a profile for the specified user name. Takes a parameter indicating whether the user is authenticated or anonymous. 

Parameters: 
username: The name of the user to create a profile for. 
isAuthenticated: true to indicate the user is authenticated; false to indicate the user is anonymous. 

Returns: 
A System.Web.Profile.ProfileBase object that represents the profile for the specified user. 
相關問題