How can I update logged in user's UserInfo?

Sourav Dutta asked on January 13, 2015 20:31

Is there any way to update current user's UserInfo?

Suppose a user registered with an email and password,I have customized the CMS_User and added field as MyCV which is a GUID type.Upon logged in,I am trying to upload a file but when the code hits update,it always results in exception.As the user is already logged in and if we try to change the UserInfo,the code might be unstable but is there any workaround in that particular case.

I have tried creating another object of the UserInfo but still gave the same exception.

UserInfo updateUser = UserInfoProvider.GetUserInfo(CurrentUser);
    if (updateUser != null)
        // Update the properties
        updateUser.FullName = updateUser.FullName.ToLower();
        // My Other Code

        // Save the changes
        **UserInfoProvider.SetUserInfo(updateUser);** *//Exception Occurs*

        return true;

Recent Answers

Brenden Kehren answered on January 13, 2015 20:56

When are you trying to do this? When a user is registering? If so, you might want to make it a multi-step process.

0 votesVote for this answer Mark as a Correct answer

Sourav Dutta answered on January 14, 2015 03:53

No, after primary registration of the user,the user is logged in.Now after that,the user needs to update his other fields.How can I update do this? UserInfoProvider.SetUserInfo(CurrentUser);

0 votesVote for this answer Mark as a Correct answer

Roman Hutnyk answered on January 14, 2015 14:52

Sourav, Have you tried UserProfile web part with the alternative form for user? In this scenario you do not need to implement custom code - Kentico already handles that. See to get better idea what I'm talking about.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.