Convert SID to Username in C#
问题 In .net, I can create a NTAccount using domain and username, and get it's SID. But I cannot convert the SID back to NTAccount using translate function. new SecurityIdentifier(stringSid).Translate(typeof(NTAccount)).ToString(); And this two way conversion code has no problem running on Domain Controller. Maybe some configuration wrong? 回答1: SecurityIdentifier.Translate() method works only on domain accounts so perhaps your computer not attached to domain. To resolve local SIDs into account