Convertig objectSID (or SID) to String (vb.net 2005)

Hello, I need help to convert the SID or objectSID to String in Visual Basic 2005.
I see some code but always for C++

Can someone help me


Thanks  



Answer this question

Convertig objectSID (or SID) to String (vb.net 2005)

  • E.Ganesan

    The code was a help, but putting it into VB.net (as requested by original post) would have been more helpful. The typeof() doesn't seem to work
  • oscarg102941

    Dim act As NTAccount = CType(sid.Translate(Type.GetType("System.Security.Principal.NTAccount")), NTAccount)


  • Sylvain Bougnoux

    If you want the SID as a string create an instance of SecurityIdentifier.

    SecurityIdentifier sid = new SecurityIdentifier(sidString);

    If you want the name of the account associated with the SID then call Translate on the sid.

    NTAccount act = (NTAccount)sid.Translate(typeof(NTAccount));

    The returned account is the friendly name (if available) for the SID.

    Michael Taylor - 1/5/06


  • Convertig objectSID (or SID) to String (vb.net 2005)