I hope that I have titled this question appropriately. Bit of a mixed subject here.
I have created a function in C#
that creates an Active Directory User. Using an LDAP string that needs to look like this:
userinfo.displayName = "Surname, Firstname"
CN=" + userinfo.displayName, "user"
The following exception message is passed back, because of the comma being in the string.
An invalid dn syntax has been specified.
The full dn after the string has been applied is as following
"CN=Surname**,** Lastname,OU=Users,DC="Foo",DC="net"
The comma in the common name CN= is the problem...
Is there a way that C# can ignore the comma out of the string? Effectively escaping it.