달력

072018  이전 다음

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  •  
  •  
  •  
  •  
출처 : http://www.c-sharpcorner.com/uploadfile/craig_aroa/adhelper08232005064459am/adhelper.aspx?login=true&user=yheesung


흠..  예전거 보다 더 좋아진것 같습니다.
앞으로는 누가 더 검색 잘하고, 누가 더 짜집기 잘 하느냐에 따라 프로그래머의 레벨이 정해지지 않을까...


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() ;



Posted by Tornado tornado