Groups | Blog | Home
all groups > dotnet security > july 2004 >

dotnet security : LDAP binding


Joe Kaplan (MVP - ADSI)
7/22/2004 5:34:51 PM
In order to use an unqualified username, you must specify =
AuthenticationTypes.Secure (which you should do anyway to ensure that =
your credentials are encrypted on the network). You can also use the =
upn syntax (user@domain.com) or NT Logon format (domain\user) with or =
without AuthenticationTypes.Secure.

Joe K.

[quoted text, click to view]

Hi,

I am trying to bind to an Active Directory server using the following =
snippet, but I always get a user unknown or bad password error message.=20
DirectoryEntry de =3D new =
DirectoryEntry(LDAP://srv-dell.waysoft.local);
de.AuthenticationType =3D AuthenticationTypes.ServerBind;
de.Username =3D "administrator";
de.Password =3D "password";
string usr =3D de.Properties["DisplayName"].Value.ToString(); =
// the error message appears here

Any idea of what is wrong?

Thanks.
Mike
7/22/2004 11:22:18 PM

Hi,

I am trying to bind to an Active Directory server using the following =
snippet, but I always get a user unknown or bad password error message.=20
DirectoryEntry de =3D new =
DirectoryEntry(LDAP://srv-dell.waysoft.local);
de.AuthenticationType =3D AuthenticationTypes.ServerBind;
de.Username =3D "administrator";
de.Password =3D "password";
string usr =3D de.Properties["DisplayName"].Value.ToString(); // =
the error message appears here

Any idea of what is wrong?

Thanks.
Mike
7/23/2004 6:08:59 AM

Thanks Joe. I can now see the various properties.

Is there a possibility to query the Active Directory to gather some =
information about the user (group, phone, etc.)? How can I do that?

Thanks.
Mike



"Joe Kaplan (MVP - ADSI)" <joseph.e.kaplan@removethis.accenture.com> =
[quoted text, click to view]
AuthenticationTypes.Secure (which you should do anyway to ensure that =
your credentials are encrypted on the network). You can also use the =
upn syntax (user@domain.com) or NT Logon format (domain\user) with or =
without AuthenticationTypes.Secure.

Joe K.

[quoted text, click to view]

Hi,

I am trying to bind to an Active Directory server using the =
following snippet, but I always get a user unknown or bad password error =
message.=20
DirectoryEntry de =3D new =
DirectoryEntry(LDAP://srv-dell.waysoft.local);
de.AuthenticationType =3D AuthenticationTypes.ServerBind;
de.Username =3D "administrator";
de.Password =3D "password";
string usr =3D de.Properties["DisplayName"].Value.ToString(); =
// the error message appears here

Any idea of what is wrong?

Thanks.
Joe Kaplan (MVP - ADSI)
7/23/2004 9:26:53 AM
You just need to know the names of the attributes that store those =
values. Based on the syntax you have below, you can get the additional =
values using the same syntax as you used for displayName.

I'd suggest using a tool like ldp.exe or ADSI Edit to view all of the =
available AD data for a user and figure out what all the attribute names =
are. Then, you can translate that to your code.

If you want to do queries against AD instead of binding to specific =
objects, you should use the DirectorySearcher.

Most of the support for this stuff goes on in =
microsoft.public.adsi.general (.NET and COM). Also, there's good stuff =
in the Directory Services SDK documentation in MSDN.

Joe K.
[quoted text, click to view]

Thanks Joe. I can now see the various properties.

Is there a possibility to query the Active Directory to gather some =
information about the user (group, phone, etc.)? How can I do that?

Thanks.
Mike



"Joe Kaplan (MVP - ADSI)" <joseph.e.kaplan@removethis.accenture.com> =
[quoted text, click to view]
AuthenticationTypes.Secure (which you should do anyway to ensure that =
your credentials are encrypted on the network). You can also use the =
upn syntax (user@domain.com) or NT Logon format (domain\user) with or =
without AuthenticationTypes.Secure.

Joe K.

[quoted text, click to view]

Hi,

I am trying to bind to an Active Directory server using the =
following snippet, but I always get a user unknown or bad password error =
message.=20
DirectoryEntry de =3D new =
DirectoryEntry(LDAP://srv-dell.waysoft.local);
de.AuthenticationType =3D AuthenticationTypes.ServerBind;
de.Username =3D "administrator";
de.Password =3D "password";
string usr =3D de.Properties["DisplayName"].Value.ToString(); =
// the error message appears here

Any idea of what is wrong?

Thanks.
AddThis Social Bookmark Button