How to convert SID to String in .net

前端 未结 3 2035
囚心锁ツ
囚心锁ツ 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:20

    Take a look at the SecurityIdentifier class. You can then do simple things like,

    var sidInBytes = (byte[]) *somestuff*
    var sid = new SecurityIdentifier(sidInBytes, 0);
    // This gives you what you want
    sid.ToString();
    

提交回复
热议问题