While I am setting User’s Profile below error occurs
Error: “The type initializer for 'DotNetNuke.Entities.Profile.ProfileController' threw an exception ”
Below is my scenario…
I have added reference of the “DoNetNuke.dll” to my class library, In one class I have created one function which will return list of UserInfo. Like below…
public static List<UserInfo> FillUserInfoCollection(SqlDataReader userinfo)
{
List<UserInfo> lstobject = new List<UserInfo>();
while (userinfo.Read())
{
UserInfo obj = new UserInfo();
obj.IsSuperUser = false;
obj.PortalID = 0;
obj.UserID = int.Parse(userinfo["UserID"].ToString());
obj.Username = userinfo["Username"].ToString();
obj.Email = userinfo["Email"] != null ? userinfo["Email"].ToString() : string.Empty;
obj.Profile.InitialiseProfile(obj.PortalID, true); [ERROR LINE]
obj.Profile.SetProfileProperty("FirstName", userinfo["FirstName"].ToString());
lstobject.Add(obj);
}
return lstobject;
}
I am getting above mentioned error , can anyone how to resolve that error?
Thanks,
Hitesh Panchal