In my ActionResult UserProfile(), among other things, I create a new instance of ProfileInformation,
Code:
ProfileInformation profileInformation = new ProfileInformation()
{
FirstName = ProfileBase.GetPropertyValue("PersonalInformation.FirstName").ToString(),
LastName = profileBase.GetPropertyValue("PersonalInformation.LastName").ToString(),
Gender = profileBase.GetPropertyValue("PersonalInformation.Gender").ToString(),
BirthDate = (DateTime)profileBase.GetPropertyValue("PersonalInformation.BirthDate"),
Occupation = profileBase.GetPropertyValue("PersonalInformation.Occupation").ToString(),
Country = profileBase.GetPropertyValue("PersonalInformation.Country").ToString(),
Website = profileBase.GetPropertyValue("PersonalInformation.Website").ToString(),
};
However, while debugging I get "System.InvalidCastException was unhandled by user code"
I can't figure out why, what the cause is for this exception?