page. As an administrator i need to retrieve a specific user information stored
within profile property in web.config. I used ProfileCommon class with GetProfile
method that i built my self because that class and method are not in .Net
framework Don't mind my terminology I'm still a novice
This is how i define the class, properties and GetProfile method
public class ProfileCommon : ProfileBase
{
public string PostalCode
{
get
{
return (string)HttpContext.Current.Profile.GetPropertyValue
("PostalCode");
}
set
{
HttpContext.Current.Profile.SetPropertyValue("PostalCode", value);
}
}
public string Country
{
get
{
return (string)HttpContext.Current.Profile.GetPropertyValue("Country");
}
set
{
HttpContext.Current.Profile.SetPropertyValue("Country", value);
}
}
public virtual ProfileCommon GetProfile(string username)
{
return Create(username) as ProfileCommon;
}
}
This is how I'm trying to retrieve information on a specific user
// I retrieved the unique identifier of a user in my Order table.
Customer = Membership.GetUser(new Guid(orderRow["CustomerID"].ToString()));
// I try to use it to retrieve a user specific info stored in web.config
ProfileCommon pro = new ProfileCommon();
CustomerProfile = pro.GetProfile(Customer.UserName);
postalCodeLabel.Text = CustomerProfile.PostalCode;
countryLabel.Text = CustomerProfile.Country;
please is their any other way I can retrieve this information or is there anything I'm
not doing right cos I'm suspecting the definition of my GetProfile method. I will really appreciate it if I can get the solution to this problem
ramya bharathPosted Sep 1, 2015, 5:21 PM