The country
is not a Property by default in MembershipUser
, unless you manually specified them in your profile provider.
U have got to use the System.Web.Profile.ProfileBase class .
Here a greate class from @Sky Sanders which also uses the Membership class
public class UserProfile : ProfileBase
{
public static UserProfile GetUserProfile(string username)
{
return Create(username) as UserProfile;
}
public static UserProfile GetUserProfile()
{
return Create(Membership.GetUser().UserName) as UserProfile;
}
[SettingsAllowAnonymous(false)]
public string CountryCode
{
get { return base["countryCode"] as string; }
set { base["countryCode"] = value; }
}
[SettingsAllowAnonymous(false)]
public string Description
{
get { return base["Description"] as string; }
set { base["Description"] = value; }
}
[SettingsAllowAnonymous(false)]
public string Location
{
get { return base["Location"] as string; }
set { base["Location"] = value; }
}
[SettingsAllowAnonymous(false)]
public string FavoriteMovie
{
get { return base["FavoriteMovie"] as string; }
set { base["FavoriteMovie"] = value; }
}
}
Here are some helpful links
How to assign Profile values?
How can i use Profilebase class?
Hope it helps.