I am reading the displayName property from ActiveDirectory.
On Windows Server 2008, result.Properties["displayName"][0].ToString()
is the displayName, while on Windows Server 2012, it returns System.Byte[]
. Now I have to convert the value using sth like var buffer = result.Properties["displayName"][0]; Encoding.%SomeEncoding%.GetString(buffer, 0, buffer.Length);
var buffer = result.Properties["displayName"][0]; Encoding.%SomeEncoding%.GetString(buffer, 0, buffer.Length);
,
but I don't know which Encoding Microsoft chose - UTF, ISO, Default, Local?
By the way, is there a "cheat sheet" on AD properties and their types available?
Active Directory实现LDAP v3并使用UTF-8 。
你可以从AD读取一个字节值,如下所示:
Encoding.UTF8.GetString((byte[])userRow.Properties["mailNickname"][0]);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.