Click here to Skip to main content
11,798,046 members (78,418 online)
Click here to Skip to main content

Free Web / Browser Based Active Directory Phonebook

, 18 Nov 2011 CPOL 30.3K 3.7K 20
Rate this:
Please Sign up or sign in to vote.
Uses ANR LDAP query to find user phone number and email address information stored in Active Directory
Screen Shot - maximum width is 600 pixels


This program performs an LDAP ANR search of Active Directory for whatever string is in the name field when search button is clicked. Then it displays the results in a gridview control.

Wow! This VB.NET web application turned out great! As an added benefit; it's an awesome example of how you can pull off really cool apps without knowing a lick about what you're doing. OK I'm a pretty good VB.NET backyard programmer, but nobody's going to hire me to write code. Anyhow I get this idea, "Let's try and take the example I used on my website last week (Example 1) and attempt to port it to the web". Well, I spent a couple of nights searching the net for anything that could show me how. I found lots of stuff, much of it in C#, but I couldn't figure it out. I asked a buddy who gives me lots of VB.NET tips and he confessed that he too found it to be very challenging. Then on my 3rd night of fruitless searching, I stumbled on this ASP.NET GridView control demo. It turned out to be pure GOLD! Within an hour or two, I had a proof-of-concept and a day later the program I present here.


Basically the demo showed me how to feed data to a gridview control from memory or from a database. I started with a new project and selected ASP.NET Web Application (which proved to be pretty awesome on its own before I added a stitch of code), then I cut out or commented out the parts I didn't need from the demo, pasted in the stuff I chose to keep, added a few columns, hid a column and a few controls, added a textbox, a button and a checkbox, pasted in the search routine from Ex.1 and BANG! New program.

Read more history here.

Using the Code

Running it in debug mode and getting it to run on a web server were two entirely different things, I followed the instructions I found here ASP.NET Web Application Project Deployment Overview and eventually got it working. You can check out a working demo here. I'd rather have had an active directory it could search for you, but this is enough to show you the basic idea.

Note: For purposes of the Web-Demo, I converted it back into a Database app. The AD version, provided in the download, works the same way except for the edit/Delete and Add features.

Anyhow enjoy the code, I believe it will work in any environment where there's a Windows Domain Controller although you'll need to publish it to a webserver with .NET 4.0. Use the Microsoft link I provided above for more guidance. You may also wish to customize the column labels or the fields pulled from AD to suit your own organization. Here's a list of Active Directory User Attributes you can use as a guide. ENJOY!

Open with Visual Studio and press F5. Enter a name in the field provided click search. The functions of the check boxes are self explanatory. You may customize as much as you'd like, then publish it to a webserver.


Be sure to check for updates.

  • 11-2-2011: Initial version
  • 11-18-2011: Cleaned up redundant and unused code, added a little more commenting, removed "First Name" & "last name" columns and replaced them with a single "User Name" column, also added the ability to automatically display the selected users thumbnail photo; when it's present in active directory


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Robert Kirchhof
Network Administrator Tupperware Brands
United States United States
I've been with Tupperware as a consultant since July 2014.

You may also be interested in...

Comments and Discussions

GeneralMy vote of 2 Pin
zohaib12121214-Nov-14 12:29
memberzohaib12121214-Nov-14 12:29 
QuestionAd Phonebook Pin
dadaman691-Mar-13 4:53
memberdadaman691-Mar-13 4:53 
AnswerRe: Ad Phonebook Pin
dadaman694-Mar-13 20:21
memberdadaman694-Mar-13 20:21 
SuggestionConstructive Criticism Pin
Clark Kent12320-Dec-11 8:15
memberClark Kent12320-Dec-11 8:15 
I gave you a vote of 4. I thought this article has great potential. Your enthusiasm is apparent and comes across very well for a thirst of learning and trying new things.

I wanted to give a vote of 5, but one thing that this article was lacking is examples. Don't get me wrong I appreciate the MSDN links that helped you to achieve your desired goal.

Here are some questions that I thought maybe you could address in this article. Keep in mind that these are all suggestions.

But what were if any challenges in the code? How did you overcome them? Did you notice that a particular programming technique was more suited to achieve your goal? Where is the essential code that I should focus on that does the bulk of the work if any?

Keep in mind the reason why I ask these questions is I don't claim to be a perfect programmer so I like to see how other programmers find solutions to their challenges. Your approach to the solution could be something that I might have not considered on how to solve a problem. Make sense?

Keep up the good work and keep on coding! Smile | :)

My 2 cents.
GeneralMy vote of 4 Pin
Member 43874628-Nov-11 9:20
memberMember 43874628-Nov-11 9:20 
GeneralRe: My vote of 4 Pin
Robert Kirchhof8-Nov-11 11:01
memberRobert Kirchhof8-Nov-11 11:01 
QuestionFeedback Pin
Robert Kirchhof6-Nov-11 13:30
memberRobert Kirchhof6-Nov-11 13:30 
AnswerRe: Feedback Pin
dadaman694-Mar-13 20:24
memberdadaman694-Mar-13 20:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.151002.1 | Last Updated 18 Nov 2011
Article Copyright 2011 by Robert Kirchhof
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid