We had an issue where the SPContext.Current.Web.CurrentUser.LoginName displayed the incorrect (old) login for a user i.e. user loginname was changed.
In most cases it works to run the migrateuser command to link the old and new account. But in some cases this does not pull through correctly.
The following solution worked for us (as an example let’s say the site that gives the problem is http://mysite”:
- Go to http://mysite/_catalogs/users/simple.aspx
- Filter by the user’s name
- You should see 2 items for the user’s name
- Click through both. The one will show you the user’s profile, the other will show a profile stub (looks like a list item). Delete the stub item