5

I'm working on a Sitecore 8.1 (rev. 160302) build running our custom code on .NET 4.5. As far as I know using the out of the box Security provider there are no ways to update username programatically as it's a read only property. I know this is possible using ASP.NET Identity framework but as far as I can tell this build version does not use the identity framework.

Are there any ways of updating the username for this version?

4

Well yes. But it will require scripting, there is no OOTB solution.

First, you will need to do the actual user name update in the underlying ASP.NET Membership Tables. Something like:

UPDATE aspnet_Users SET UserName=@NewUsername,LoweredUserName=@LoweredNewUsername WHERE UserName=@OldUsername

Sitecore 5.x to 8.x runs on a completely standard ASP.NET Membership implementation.

More information here: https://stackoverflow.com/questions/1001491/is-it-possible-to-change-the-username-with-the-membership-api

Then you will need to update the Security field on all Sitecore Items, where the user name have been applied. If you followed Best Practices, there would be none (you should assign permissions to roles, not users).

Probably an AppPool reset will be required once you're done.

| improve this answer | |
  • Don't forget any Item Locks that a user might be holding as well. – jammykam Mar 22 '18 at 19:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.