.NET returns an invalid username

I made a spelling mistake when I created an account a few days ago. I changed the account, and they can enter the domain with a new name. However, we do have an in-house web application that is still typing 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 AD? Somewhere I can change the name that will lead to System.Security.Principal.WindowsIdentity.GetCurrent (). Name; giving the correct name?

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

+6
source share
1 answer

Go here for an answer:

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

Add Key:

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

Into your registry as it is cached. I do not think that restarting IIS will fix this problem.

+2
source

Source: https://habr.com/ru/post/944634/


All Articles