How to convert SID to String in .net

前端 未结 3 2026
囚心锁ツ
囚心锁ツ 2021-02-05 03:48

I would like to convert the SID\'s System.Byte[] type to a String.

My code:

string path = \"LDAP://DC=abc,DC=contoso,DC=com\";
DirectoryEntry entry = new         


        
3条回答
  •  滥情空心
    2021-02-05 04:22

    After load the property in directoryEntry ....

    var usrId = (byte[])directoryEntry.Properties["objectSid"][0];
    var objectID = (new SecurityIdentifier(usrId,0)).ToString();
    

提交回复
热议问题