PDA

Click to See Complete Forum and Search --> : ASP.NET Web/Browser Based Active Directory Phonebook


RKirchhof
Oct 28th, 2011, 04:19 PM
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 controll.

Wow! I think 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 rkirchhof.com 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 (http://code.msdn.microsoft.com/VBASPNETGridView-19039173). 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 data base. I started with a new project and selected ASP.NET Web Application (Which proved to be pretty awesome on it's 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 choose to keep, added a few columns, hid a column and a few controls, added a textbox, a button and a check box, pasted in the search routine from Ex.1 and BANG! New program.

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 (http://msdn.microsoft.com/en-us/library/dd394698.aspx) and eventully got it working. You can check out a working demo here (http://RKirchhof.com/Phone). 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 guidence. 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 (http://www.kouti.com/tables/userattributes.htm)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 RKirchhof.Com (http://RKirchhof.Com) for updates.

http://rkirchhof.com/download/phonebook.jpg