2012-11-15 24 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. 
相关问题