Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET returning incorrect username

I made a spelling mistake when I created an account a few weeks back. I changed the account and they can log onto the domain with the new name. However we have a web application in house that is still picking up the wrong name.

The .net application uses

System.Security.Principal.WindowsIdentity.GetCurrent().Name;

Which gives the old name.

If I use

Environment.UserName

I get the correct new name. What did I miss in the AD? Is there somewhere I can change the name which will result in System.Security.Principal.WindowsIdentity.GetCurrent().Name; giving the correct name?

I have no experience with .net so I'm very sorry if the question has an obvious answer.

like image 284
Jennifer Nolan Avatar asked May 09 '13 14:05

Jennifer Nolan


1 Answers

Check out here for the Answer:

http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/27e42d4a-6452-4840-bbf2-abbc16e22557

Add the Key:

"HKLM/System/CurrentControlSet/Control/Lsa/LsaLookupCacheMaxSize=0"

To your registry as this is cached. I don't think restarting IIS will fix this issue.

like image 129
TheKingDave Avatar answered Oct 12 '22 22:10

TheKingDave