Set user FirstName not working

Posted by Community Admin on 04-Aug-2018 18:04

Set user FirstName not working

All Replies

Posted by Community Admin on 12-Sep-2012 00:00

string username = Request["username"];
            UserManager userManager = UserManager.GetManager();
            UserProfileManager profileManager = UserProfileManager.GetManager();


            User user = userManager.GetUsers().Where(u => u.UserName == username).SingleOrDefault();
            if(user != null)
           
                //var profile = profileManager.GetUserProfile<SitefinityProfile>(user);
                //profile.FirstName = tbFirstName.Text;

                //UserProfileManager userProfileManager = UserProfileManager.GetManager();
                //UserProfile profile1 = userProfileManager.GetUserProfile(user.Id, typeof(SitefinityProfile).FullName);
                //Telerik.Sitefinity.Model.DataExtensions.SetValue(profile1, "FirstName", "FirstName");
                
                user.Email = tbEmail.Text; //works!
                userManager.SaveChanges();
           
None of commented methods work. Wht? Thanks!

This thread is closed