troubleshooting Question

SID convert to string

Avatar of Pollin
Pollin asked on
Visual Basic.NET
4 Comments1 Solution2644 ViewsLast Modified:
Does anybody knows how to convert a SID from byte to the string format   S-1-55-11..... ????

I am using

Dim userEntry As New System.DirectoryServices.DirectoryEntry(user1)
userEntry.Properties("objectSid").Value

to retrieve the SID from AD but it is in byte type. I need to show it in a text box and compare it with another SID.

I tried to use

                Dim enc As New System.Text.ASCIIEncoding
                Response.Write(enc.GetString(userEntry.Properties("objectSid").Value))

but it show unreadable data and I need the format S-1-5-11

Thanks in advance
ASKER CERTIFIED SOLUTION
oleggold

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros