Introduction
Microsoft’s Active Directory aka AD is used to manage user,
computer and other resources on Domain Cotroller. There are many tools
available for managing Active Directory. When it comes to deal with Active
directory its headache for many programmers. There are plenty of sample code available on Microsoft’s
MSDN foum.
Technical
Working with Active directory one has be concern about
Network Security, business Rule and Technological constraints. If you are
accessing your Active Directory through ASP.Net /MVC Web Application, then you
must be sure about the permission at IIS level and Domain Controller Level.
For Accessing Active directory protocol used is known as
LDAP(Lightweight Directory Access Protocol). Microsoft Provides methods to deal
with LDAP in System.DirectoryServices assembly.
In DirectoryServices
Assembly a class named DirectoryEntry used to access Active Directory. This class
inherits Component class.
By creating instance of this class we create
pointer to all directory entries. Constructor of this class take LDAP
Url,credential and Authentication Type as arguments as shown bellow:
DirectoryEntry MailFolder = new DirectoryEntry(LDAPPath,”username”, “password”, AuthenticationTypes.Secure);
Here authenticationType enum does have following values
- Anonymous
- Delegation
- Encryption
- Fastbind
- None
- ReadOnlyServer
- Sealing
- Secure
- SecureSocketssLayer
We have
chosen here to have Secure AuthenticationType.
Parameter “LDAPPath”: This will be the Ldap Url that points to
your active directory
For ex. LDAP://myDc.myServer.net:389/DC=myServer,DC=net
Parameter “Username”: This will be the username that have access
to Active Directory.
Parameter “Password”: Password for supplied username.
Comments
Post a Comment