SIGN UP MEMBER LOGIN:    
ARTICLE

ADHelper - An Active Directory Class

Posted by Craig Aroa Articles | Active Directory C# September 18, 2002
Working on my latest project required quite a degree of development against the Active Directory.
Reader Level:
Download Files:
 

Working on my latest project required quite a degree of development against the Active Directory. Not having had any AD experience before slowed me down for a while, but after trawling through lost of news groups etc, I gathered enough information to do what I needed to do.

I have developed an ADHelper class that will should take care of most AD requirements, from :-

  • creating/updating a user
  • assigning a user to a group
  • enabling/disabling their account
  • setting password
  • checking if a user is valid
  • loggin in
  • checking if a user exists
  • performing queries

All while returning DataSets to allow easy binding to datagrids etc.

Im by no means an expert, but hopefully this helps some of you facing the same problems that I had.

NOTES
=====

This class will return a mix of ActiveDirectory 'DirectoryEntry' objects and DataSets that u can plug into your business layer

The first couple of lines that set the following private varables, need to be changed so that the 'Configuration' is the .Net ConfigurationSettings.AppSettings["xxx"].ToString, as the configuration object is a custom one that has not been included.

private static string ADPath=Configuration.ADFullPath ;
private static string
ADUser = Configuration.ADAdminUser ;
private static string ADPassword = Configuration.ADAdminPassword ;

Change to :-

private static string ADPath=ConfigurationSettings.AppSettings["ADFullPath"].ToString() ;
private static string
ADUser = ConfigurationSettings.AppSettings["ADAdminUser"].ToString() ;
private static string ADPassword = ConfigurationSettings.AppSettings["ADAdminPassword"].ToString() ;

Login to add your contents and source code to this article
share this article :
post comment
 

I also have error on ConfigurationSettings.AppSettings, so i want to know how u solve the problem, thank you very much!

Posted by MaoMao Mar 30, 2012

your code looks good, but why do I get erros on configurationsettings

Posted by Peter Ceulemans Feb 12, 2011

very good,thanks a lot

Posted by peter john Nov 27, 2008
Nevron Gauge for SharePoint
Become a Sponsor
PREMIUM SPONSORS
  • Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
    The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor