August 12, 2016 by Ruaan Harmzen

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

One thought on “SPContext.Current.Web.CurrentUser.LoginName

  1. Mondli says:

    Good find..

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: