I am trying to get Profile properties in the code behind. But I am not getting any intellisence like Profile.Homephone
or Profile.CellPhone
. When I try:
Dim memberprofile As ProfileBase = HttpContext.Current.Profile
Dim homePhone As String = memberprofile.GetPropertyValue("HomePhone").ToString()
I get Data is Null
. This method or property cannot be called on Null values error. I have data for current user in the profile Table.
I get following results in immediate window
?HttpContext.Current.Profile.UserName.ToString "sub2" ?Profile.DefaultProfile.Properties.Count 2 ? HttpContext.Current.Profile("HomePhone") "" {String} String: ""
I am not able to run property values in page load event. This is my web.config file setting:
<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>