通过LDAP查找出来的结果的Properties中经常会包含byte[]类型的SId,并不是我们在AD中看到的s-x-x-形式的。通过以下函数将其转换。

 

 1 /// <summary>
 2 /// 转换Byte Sid to string
 3 /// </summary>
 4 /// <param name="sidBinary"></param>
 5 /// <returns></returns>
 6 public static string ConvertBinarySid2String(byte[] sidBinary)
 7 {
 8     SecurityIdentifier sid = new SecurityIdentifier(sidBinary, 0);
 9     return sid.ToString();
10 }

 

相关文章:

  • 2021-07-09
  • 2021-06-07
  • 2022-01-01
  • 2021-09-26
  • 2022-03-04
  • 2021-06-30
  • 2021-05-16
  • 2021-10-30
猜你喜欢
  • 2021-10-10
  • 2022-03-09
  • 2021-08-28
  • 2022-12-23
  • 2021-11-23
相关资源
相似解决方案