2010-04-30 29 views

回答

3

web.config文件中是註釋掉的部分,用於控制是否啓用配置文件服務。啓用它將更改生成的代碼,並且HttpContext變爲可用。

您沒有從ProfileBase繼承的類將配置文件屬性顯示爲強類型屬性。然而,這不是一場災難,你只需使用

HttpContext.Current.Profile.GetPropertyValue(string propName) 

並投下結果。

0

我使用一個Web應用程序內的App_Code文件夾通過類訪問配置文件數據的常用方法爲我工作:

MembershipUser mu = Membership.GetUser(userName, false); 
ProfileCommon p = (ProfileCommon)ProfileBase.Create(mu.UserName, true);