I have to read the user log in my app even with run as and the name created in domain in windows server 2012have 23 char, i used :
Environment.UserName
new System.Security.Principal.WindowsPrincipal(System.Security.Principal.WindowsIdentity.GetCurrent()).Identity.Name;
System.Security.Principal.WindowsIdentity.GetCurrent().Name
but all this give me the name without the 3 last char I used :
UserPrincipal.Current.UserPrincipalName
UserPrincipal.Current.Name
but give me the displayed name
how can i get the full length login name
This is a hard limit on the samAccountName property:
See: this page for source
Maybe you could try the
UserPrincipalname
you need to add a reference to the
AccountManagement
Namespace