Alright... enough of that.Lets get to the Code....
First of all I want to show you guys how I divided the whole application into small components... here's is a screen shot of the app...
PS: Please click on the image to view the contents.
Each component is a stand alone component for a specific purpose....
So.. lets get into the Auth component...
So.. lets get into the Auth component...
We had a requirement where we wanted to Authenticate a user against the Active Directory...basically certain pages were not visible to certain groups...
Querying Active Directory in c# is very easy task.. but before that if you are not familiar with the structure of your active directory you can install a great utility from Microsoft called ldp.exe.
I tried it to see what is the structure of our Active Directory.
So basically to query an Active Directory you need a ldappath... like
LDAP://NXdfsdfqwM03.ABC150.org/DC=ABC150,DC=org , A username and password who has access to this Active Directory.
Now to get All the Users in a particular Group this is the code...
This function bascially calls the GetUserByGroup which in turn calls the GetUserDetails function where I am querying the active directory for a particular user.
This function bascially calls the GetUserByGroup which in turn calls the GetUserDetails function where I am querying the active directory for a particular user.

PS: Please click on the image to view contents...

PS:Please click on the image to view contents...
Important classes are DirectoryEntry, DirectorySearcher, DirectoryEntires.. etc.
I hope this gives a basic idea about how to query an Active Directory.
Happy Programming!!!
Yash

1 comments:
Can anyone recommend the best MSP system for a small IT service company like mine? Does anyone use Kaseya.com or GFI.com? How do they compare to these guys I found recently: N-able N-central service desk
? What is your best take in cost vs performance among those three? I need a good advice please... Thanks in advance!
Post a Comment