我正在尝试在后面的代码中获取 Profile 属性。但我没有得到任何类似Profile.Homephone
or的情报Profile.CellPhone
。当我尝试:
Dim memberprofile As ProfileBase = HttpContext.Current.Profile
Dim homePhone As String = memberprofile.GetPropertyValue("HomePhone").ToString()
我明白了Data is Null
。无法在 Null 值错误时调用此方法或属性。我在配置文件表中有当前用户的数据。我在即时窗口中得到以下结果
?HttpContext.Current.Profile.UserName.ToString “子2” ?Profile.DefaultProfile.Properties.Count 2 ? HttpContext.Current.Profile("HomePhone") ““ {细绳} 细绳: ””
我无法在页面加载事件中运行属性值。这是我的 web.config 文件设置:
<profile>
<providers>
<clear />
<add name="AspNetSqlProfileProvider" connectionStringName="Primary" applicationName="MyFmNow.com"
type="System.Web.Profile.SqlProfileProvider" />
</providers>
<properties>
<add name="HomePhone" type="String" />
<add name="CellPhone" type="String"/>
</properties>
</profile>