IntroductionMicrosoft Technet offers a script repository to work with AD User Accounts; however, I needed to work with .NET and It needed to be programed to bind and access the Active Directory Functionality.The code samples I provide are written in C#.
Create a Connection to Active Directory-
/// /// Method used to create an entry to the AD. /// Replace the path, username, and password. /// /// DirectoryEntry public static DirectoryEntry GetDirectoryEntry(){ DirectoryEntry diren = new DirectoryEntry(); diren.Path = "LDAP://192.168.41.11/CN=ctsa;DC=pune,DC=local"; diren.Username = @"ctsadomain\usesample"; diren.Password = "ctsa1234"; return diren; }
2. Create a secure connection to Active Directory
/// Method used to create an entry to the AD using a secure connection. /// Replace the path. /// /// DirectoryEntry public static DirectoryEntry GetDirectoryEntry(){ DirectoryEntry diren = new DirectoryEntry(); diren.Path = "LDAP://192.168.41.11/CN=Users;DC=ctsa,DC=local"; diren.AuthenticationType = AuthenticationTypes.Secure; return diren; }
Summary
However C# provides the System.DirectoryService.ActiveDirectory Namespace to use the functionality for Active Directory Programming .Using Active Directory as back end makes the application performance much better rather than using the database.Since Directory service provides the huge information all over the network with much reliablity than any database, I have only posted the starting for Active Directory Programming and will continue with its next part.
|
No responses found. Be the first to respond and make money from revenue sharing program.
|