Last post Jan 16, 2017 11:58 AM by PatriceSc
Jan 05, 2017 01:09 PM|Lexi85|LINK
I have to create a webpage which extracts data from active directory, this is a part of application which extracts data from diferent sources..one among them being Active Directory
I have thought of this idea..but I dont know how practical it is..or if you guys have got some other ideas for this please help me out
Server Address Domain Username Password
10.11.12.13 ABC Admin Password Connect Button
On connect button this application gets connected to the DC with above given credetials and runs the powershell scripts to get data...Is it possible to code this all on connect button using vb.net and asp.net?
store the data in text file and save textfile on local computer where this application is installed.....Is it possible to do all this?
Jan 06, 2017 08:11 AM|Lexi85|LINK
Someone please suggest me some good deas and advices....I really need them to start this process
Jan 06, 2017 08:54 AM|Chris Zhao|LINK
You could use the System.DirectoryServices namespace to search for information in Microsoft Active Directory.
Jan 06, 2017 11:41 AM|Lexi85|LINK
With my application Can I make connection to AD on the server and run a powershell scripts attached to my application on it? Also after running the powershell script can I store the extracted data results in a text file on my local computer or attach to
Jan 06, 2017 01:54 PM|PatriceSc|LINK
System.DirectoryServices is not enough? It would be likely simpler...
You can use run "PowerShell" on a server (or even on a remote server) but it might be more complex: see
As usual the web server won't be able to write directly this text file to a client computer. Your web site would have to send the file to the user than will then download this file.
Depending on your actual need, if this is for your own consumption, I believe Excel allows to read AD data using
https://support.office.com/en-us/article/Import-data-from-external-data-sources-Power-Query-be4330b3-5356-486c-a168-b68e9e616f5a (if this is the only reason for which you are using a web site).
Jan 09, 2017 08:06 AM|Lexi85|LINK
thanks...that was helpful...the thing is my client wants me to build a webpage which basically shows how to extract information from different data sources...like sql oracle and ad
for sql and oracle I am satisfied with giving servername, username and password and connect button on the screen which I can code as connect to the database using provided credentials but really not sure about active directory...what do I use on my webpage..so
that it asks for credentials and connects to AD
Jan 09, 2017 08:26 AM|PatriceSc|LINK
http://blogs.artinsoft.net/Mrojas/archive/2012/01/10/List-users-in-Active-Directory-with-C.aspx and you can use instead the
https://msdn.microsoft.com/en-us/library/bb356158(v=vs.110).aspx constructor if you need to provide a user/password to get access.
Jan 09, 2017 08:45 AM|Lexi85|LINK
Thanks...I understand the concept that there is a possible way of connecting to active directory using...servername, username and password...I assume I get connected to activedirectory..and what after that?search or extract data would be through .net itself...?????????Like
u said previously we cannot get the textfile from serverside to client side I agree...as of now I have to design and show how it works rather than actually implement it for now but later ofcourse I will implement it...but for now to show them how the process
works...what do u think is advisable to show on the webpage design..
Connect to AD
Apart from this when the connection gets established...what do u think should be the design ?I should show next...for example a button which says "Run powershell script" or "Search for data" or what?
Jan 09, 2017 09:12 AM|PatriceSc|LINK
Yes, just look at the code. It uses just .NET classes intended for this usage. The page design is up to you (or them) depending on which flexibility you want. I would start with the user name and password and the code that reads user data.
Then you can always add aditional field depending on which flexibility you want but it should be very easy if you have the core stuff up and running.
Jan 16, 2017 10:58 AM|Lexi85|LINK
Yes I agree...I am just trying to frame up things I need and as I am new looking for stuff online but I find most of it in windows not web application...for example I have got below code..how do I display the output here in my webpage now
public static void Main()
var ctx = new PrincipalContext(ContextType.Domain,"Artinsoft",
UserPrincipal userPrin = new UserPrincipal(ctx);
userPrin.Name = "*";
var searcher = new System.DirectoryServices.AccountManagement.PrincipalSearcher();
searcher.QueryFilter = userPrin;
var results = searcher.FindAll();
foreach (Principal p in results)
Jan 16, 2017 11:58 AM|PatriceSc|LINK
Which web UI Framework are you using? If using Web Forms I would suggest
With MVC it would be
Try perhaps as well
Please have a look first at this kind of tutorial and feel free to post again. It will be easier to help if you have a particular question. It would be much harder if we have to start from zero so please try few tutorials first so that you can grasp the
basic stuff before asking complementary questions...