473,325 Members | 2,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Populating fields from Active Directory in asp.net -- Urgent!

Jay
I have an asp.net application that needs to fill a series of checkboxes with
usernames from a particular group in Active Directory.

Could someone please point me in the right direction in regards to a snippet
of code or a link to where I might info on this? I've checked msdn and can
find nothing definate.

Thanks in advance,

Jay
Nov 18 '05 #1
6 1057
Start with System.DirectoryServices.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Jay" <jg********@scf.sk.ca> wrote in message
news:#f**************@tk2msftngp13.phx.gbl...
I have an asp.net application that needs to fill a series of checkboxes with usernames from a particular group in Active Directory.

Could someone please point me in the right direction in regards to a snippet of code or a link to where I might info on this? I've checked msdn and can find nothing definate.

Thanks in advance,

Jay

Nov 18 '05 #2
Start with System.DirectoryServices.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Jay" <jg********@scf.sk.ca> wrote in message
news:#f**************@tk2msftngp13.phx.gbl...
I have an asp.net application that needs to fill a series of checkboxes with usernames from a particular group in Active Directory.

Could someone please point me in the right direction in regards to a snippet of code or a link to where I might info on this? I've checked msdn and can find nothing definate.

Thanks in advance,

Jay

Nov 18 '05 #3
This is basic code that will list out all the user name. I would advise to
also look into the Filter property of the DirectorySearcher
Of course you would have to change the Response.Write's to whatever or
however you want to output the data retreived
I hope this helps!

DirectoryEntry de = new
DirectoryEntry(ActiveDirectoryQuery,Username,Passw ord);
DirectorySearcher ds = new DirectorySearcher(de);
try{
SearchResultCollection src = ds.FindAll();
foreach(SearchResult sr in src){
Response.Write(sr.Properties["samaccountname"][0].ToString();
}
}
catch(Exception ex){
Response.Write(ex.Message);
}

--
Abdellah Elamiri
..net Developer
Efficacy through simplicity
"Jay" <jg********@scf.sk.ca> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I have an asp.net application that needs to fill a series of checkboxes with usernames from a particular group in Active Directory.

Could someone please point me in the right direction in regards to a snippet of code or a link to where I might info on this? I've checked msdn and can find nothing definate.

Thanks in advance,

Jay

Nov 18 '05 #4
This is basic code that will list out all the user name. I would advise to
also look into the Filter property of the DirectorySearcher
Of course you would have to change the Response.Write's to whatever or
however you want to output the data retreived
I hope this helps!

DirectoryEntry de = new
DirectoryEntry(ActiveDirectoryQuery,Username,Passw ord);
DirectorySearcher ds = new DirectorySearcher(de);
try{
SearchResultCollection src = ds.FindAll();
foreach(SearchResult sr in src){
Response.Write(sr.Properties["samaccountname"][0].ToString();
}
}
catch(Exception ex){
Response.Write(ex.Message);
}

--
Abdellah Elamiri
..net Developer
Efficacy through simplicity
"Jay" <jg********@scf.sk.ca> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I have an asp.net application that needs to fill a series of checkboxes with usernames from a particular group in Active Directory.

Could someone please point me in the right direction in regards to a snippet of code or a link to where I might info on this? I've checked msdn and can find nothing definate.

Thanks in advance,

Jay

Nov 18 '05 #5
Jay
Thanks very much the snippet, I can now search my AD structure and filter,
etc without a problem but I've run into one more snag:

Must I use a specific username and password to access my AD or can I somehow
use the already authenticated user credentials? Obviously I can populate
the Username using iPrincipal but how can I tell it to use its associated
password??

Thanks again in advance,

Jay
"A. Elamiri" <abdellahDOTelamiriATclintonDOTedutNOSPAM> wrote in message
news:OE**************@TK2MSFTNGP10.phx.gbl...
This is basic code that will list out all the user name. I would advise to
also look into the Filter property of the DirectorySearcher
Of course you would have to change the Response.Write's to whatever or
however you want to output the data retreived
I hope this helps!

DirectoryEntry de = new
DirectoryEntry(ActiveDirectoryQuery,Username,Passw ord);
DirectorySearcher ds = new DirectorySearcher(de);
try{
SearchResultCollection src = ds.FindAll();
foreach(SearchResult sr in src){
Response.Write(sr.Properties["samaccountname"][0].ToString();
}
}
catch(Exception ex){
Response.Write(ex.Message);
}

--
Abdellah Elamiri
.net Developer
Efficacy through simplicity
"Jay" <jg********@scf.sk.ca> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I have an asp.net application that needs to fill a series of checkboxes

with
usernames from a particular group in Active Directory.

Could someone please point me in the right direction in regards to a

snippet
of code or a link to where I might info on this? I've checked msdn and

can
find nothing definate.

Thanks in advance,

Jay


Nov 18 '05 #6
Jay
Thanks very much the snippet, I can now search my AD structure and filter,
etc without a problem but I've run into one more snag:

Must I use a specific username and password to access my AD or can I somehow
use the already authenticated user credentials? Obviously I can populate
the Username using iPrincipal but how can I tell it to use its associated
password??

Thanks again in advance,

Jay
"A. Elamiri" <abdellahDOTelamiriATclintonDOTedutNOSPAM> wrote in message
news:OE**************@TK2MSFTNGP10.phx.gbl...
This is basic code that will list out all the user name. I would advise to
also look into the Filter property of the DirectorySearcher
Of course you would have to change the Response.Write's to whatever or
however you want to output the data retreived
I hope this helps!

DirectoryEntry de = new
DirectoryEntry(ActiveDirectoryQuery,Username,Passw ord);
DirectorySearcher ds = new DirectorySearcher(de);
try{
SearchResultCollection src = ds.FindAll();
foreach(SearchResult sr in src){
Response.Write(sr.Properties["samaccountname"][0].ToString();
}
}
catch(Exception ex){
Response.Write(ex.Message);
}

--
Abdellah Elamiri
.net Developer
Efficacy through simplicity
"Jay" <jg********@scf.sk.ca> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I have an asp.net application that needs to fill a series of checkboxes

with
usernames from a particular group in Active Directory.

Could someone please point me in the right direction in regards to a

snippet
of code or a link to where I might info on this? I've checked msdn and

can
find nothing definate.

Thanks in advance,

Jay


Nov 18 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jay | last post by:
I have an asp.net application that needs to fill a series of checkboxes with usernames from a particular group in Active Directory. Could someone please point me in the right direction in regards...
3
by: Chris L | last post by:
Hello, I'm hoping to find out if it is possible to connect within an ASP.NET application to Active Directory with the credentials of the person who accessed the ASP.NET application via IIS,...
6
by: varkey.mathew | last post by:
Dear all, Bear with me, a poor newbie(atleast in AD).. I have to authenticate a user ID and password for a user as a valid Active Directory user or not. I have created the IsAuthenticated...
2
by: MJ | last post by:
Hi, I'm trying to authenticate a user by creating a DirectoryEntry using the contructor with signature Dim objEntry = New DirectoryEntry(path, username, pwd). and then i check for If Not...
10
by: Hriday | last post by:
Hi there, Please help me..It is urgent This is Hriday, working on windows authentication with Active Directory... My requirment is when a user sends a request to my web Applicatoin I want to...
2
by: Jim in Arizona | last post by:
My goal, somehow, is to populate a dropdownlist with all the user names in active directory. I don't even know where to begin, really. I added a reference to System.DirectoryServices so I could...
4
by: IainM | last post by:
How can I enumerate AD objects (only in a given OU, not sub OUs) using the DirectoryEntry object? Let me know of this is the wrong forum for this question. Thanks, Iain
0
by: SAMEEP | last post by:
Hi, I am creating a project based on Active Directory in WIndows server 2003 How can I get the Objects of the Active Directory such as Computers,Contacts,Users,Groups,etc Using the VB.NET ...
1
by: =?Utf-8?B?TWljaGFlbCBkZSBWZXJh?= | last post by:
To all, Is there a way to query all the objects in active directory within SQL Query analyzer? I really like to write my own sql statements before putting them into a sqlstr function within my...
0
by: eslamKotb | last post by:
Hi everyone I need to make table in SQL to point to data exist in Active Directory without duplicating data and to be dynamic i.e if data changed in Active Directory i can see this change throught...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.