ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old May 8th, 2002, 07:20 PM
mario.a.nunes mario.a.nunes is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2002
Location: Porto,Portugal
Posts: 10 mario.a.nunes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Asp + Nt4 + User + Groups

Hello everybody!

I am writing an intranet with ASP, and i have some questions:

How can i obtain the complete user list that belong to a domain?

How can i obtain the NT4 group list for a specific user?

Thanks in advance.

Reply With Quote
  #2  
Old May 9th, 2002, 12:57 AM
MawlRats MawlRats is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Posts: 13 MawlRats User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
i think that's a questions that james yang should answer... james...

Reply With Quote
  #3  
Old May 9th, 2002, 11:05 AM
James Yang James Yang is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Atlanta, Georgia
Posts: 284 James Yang User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 45 sec
Reputation Power: 16
Send a message via ICQ to James Yang
hey mario!!

to access the domain controller you can use

ADSI which allow you to access every piece of info available in AD.


have a look at these tutorials!!!
http://www.topxml.com/conference/wr...xt/adamadsi.asp
http://msdn.microsoft.com/library/d.../about_adsi.asp


If you need any furthur help give us a yell
__________________
Regards,

James Yang
.NET Developer / Network Engineer
MCSE, MCDBA, MCSA, CCNA

http://www.yellowpin.com/
http://www.opentechsupport.com/

Last edited by James Yang : May 9th, 2002 at 11:18 AM.

Reply With Quote
  #4  
Old May 9th, 2002, 11:08 AM
James Yang James Yang is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Atlanta, Georgia
Posts: 284 James Yang User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 45 sec
Reputation Power: 16
Send a message via ICQ to James Yang
hey MawlRats

just wondering.lol.... what made you think I knew the answer to that ???


Reply With Quote
  #5  
Old May 9th, 2002, 09:33 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
he was using his jedi insght

lol

Reply With Quote
  #6  
Old May 11th, 2002, 09:05 AM
mario.a.nunes mario.a.nunes is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2002
Location: Porto,Portugal
Posts: 10 mario.a.nunes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Smile

Hey james.

I don't know how MawlRats knew that you should know.
But the fact is YOU KNOW!

Thanks, for a beginner it opened to me a window to a whole new world.

Yes, indeed, i need further help.

Is there any good book about ADSI (WROX,...)?

In fact, i need to something like this:

I have an SQLserver table: users (id,username)

and i want to query the table about the users that belong to a NT4 group named TEST.

As you realize, i don't have any kind of group information in the database, so i must get the data from ADSI.

What i don't know is how to join these diferent recordsets.

Can you help me?

Thank in advance.

May the source be with you...

Reply With Quote
  #7  
Old May 11th, 2002, 09:38 AM
James Yang James Yang is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Atlanta, Georgia
Posts: 284 James Yang User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 45 sec
Reputation Power: 16
Send a message via ICQ to James Yang
hey

im actually writing an intranet app involving interaction with active directory at the moment.

Conincidentally, I also have some data in my database which join with the data in AD. I have a username, userid, commentaboutthisuser field on my db, and what i do is search AD using the username. I've actually created a class (which you can't do in ASP) which take a userid as a param and has properties(it just means 'it returns' if you don't nkow OOP) of groups(string array), fullname and otehr userful infos.

Only difference betwen yours and mine is that I m using ASP.NET and ur using ASP.

but anyway,

answering your 1st question..

sorry but i don't have any good ADSI book i can recommend. I have the wrox one but they are mostly reference

2nd Q

Ill give you an example for it ... this eg is from MSDN but i'll tell you how you can get group names by modifying it abit

'Create connection and command object
Set con = CreateObject("ADODB.Connection")
Set com = CreateObject("ADODB.Command")
'Opening the connection
con.Provider = "ADsDSOObject" 'this is the ADSI OLE-DB provider name
con.Open "Active Directory Provider"
'Create a command object for this connection
Set Com.ActiveConnection = con

'Compose a search string
com.CommandText = "select memberof,cn from 'LDAP://DC=1stleveldomain(microsoft), DC=2ndleveldomain(com) WHERE
sAMAccountName ="username"

'Execute the query
Set rs = Com.Execute
'--------------------------------------
'Navigate the record set
'--------------------------------------
While Not rs.EOF
.... rs.Fields("memberof") `GROUPS (in asp.net it returns value as an array but ASP doesn't so you should display the result and see how you can split it to put it in to array.
...rs.Fields("cn") `FULL NAME
` Put it into a string array or somethign similar
Wend

you can just replace the bold with apporoporiate values or variables and hopefully it will work without any mods

if it doesn't, give me a yell at this forum

Reply With Quote
  #8  
Old May 11th, 2002, 09:41 AM
James Yang James Yang is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Atlanta, Georgia
Posts: 284 James Yang User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 45 sec
Reputation Power: 16
Send a message via ICQ to James Yang
OOOPS

i got it the other way around

you want

list users belonging to a specific group not

list of groups which a user belong to?

k

let me just find the right property name for that

ill post another msg with another source code in a min

Reply With Quote
  #9  
Old May 11th, 2002, 09:44 AM
James Yang James Yang is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Atlanta, Georgia
Posts: 284 James Yang User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 45 sec
Reputation Power: 16
Send a message via ICQ to James Yang
got it

so
now

'Create connection and command object
Set con = CreateObject("ADODB.Connection")
Set com = CreateObject("ADODB.Command")
'Opening the connection
con.Provider = "ADsDSOObject" 'this is the ADSI OLE-DB provider name
con.Open "Active Directory Provider"
'Create a command object for this connection
Set Com.ActiveConnection = con

'Compose a search string
com.CommandText = "select member from 'LDAP://DC=1stleveldomain(microsoft), DC=2ndleveldomain(com) WHERE
cn="groupname"

'Execute the query
Set rs = Com.Execute
'--------------------------------------
'Navigate the record set
'--------------------------------------
While Not rs.EOF
.... rs.Fields("member") `Users list as string (in asp.net it returns value as an array but ASP doesn't so you should display the result and see how you can split it to put it in to array.
Wend

Reply With Quote
  #10  
Old May 11th, 2002, 09:46 AM
James Yang James Yang is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Atlanta, Georgia
Posts: 284 James Yang User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 45 sec
Reputation Power: 16
Send a message via ICQ to James Yang
I just want to note that

all these are much easier in C# hence ASP.NET

this is my code for C# in case you decide to use ASP.NET

// Login to AD
DirectoryEntry de = new DirectoryEntry();
de.Username=adAccount;
de.Password=adPassword;
de.Path=adsiPath;

// Search for the username
DirectorySearcher searcher = new DirectorySearcher();
searcher.SearchRoot=de;
searcher.Filter="(sAMAccountName="+_username+")";
searcher.SearchScope=SearchScope.Subtree;
searcher.PropertiesToLoad.Add("cn");
searcher.PropertiesToLoad.Add("memberOf");

// Get search result and get the group and full name
SearchResult result = searcher.FindOne();
_name=result.Properties["cn"][0].ToString();

// For group - String mod to remove computer/domain name b4 the group name
string tempGroupStr = result.Properties["memberOf"][0].ToString();
string[] tempGroupStrArray = tempGroupStr.Split(',');
_group=tempGroupStrArray[0].Remove(0,3);
}

Reply With Quote
  #11  
Old May 13th, 2002, 07:10 PM
CopeLand CopeLand is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Toronto
Posts: 40 CopeLand User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 16
Heh,
Jedi insight :P Ben u starwars nerd hehehe jk.
__________________
i am cope. i drink coke. i am in hope.i am cope. i drink coke. i am in hope.i am cope. i drink coke. i am in hope.

Reply With Quote
  #12  
Old May 14th, 2002, 01:18 AM
James Yang James Yang is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Atlanta, Georgia
Posts: 284 James Yang User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 45 sec
Reputation Power: 16
Send a message via ICQ to James Yang
bens not nerd

hes cool as long as I don't see him with huge darth vader helmet on tomorrow night at a cinema...its okay to like starwars...

: )

I think its quite ironic saying someones a nerd when that person is saying taht in a developers forum.. (you nkow what im implying here )


haha

Reply With Quote
  #13  
Old May 14th, 2002, 05:10 AM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
lol

you have been turned to the dark side of the force, weaklings!

adventure, excitement, a jedi not crave these things.

Reply With Quote
  #14  
Old May 14th, 2002, 05:45 PM
mario.a.nunes mario.a.nunes is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2002
Location: Porto,Portugal
Posts: 10 mario.a.nunes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thumbs up

Thank You all, in particular to James.

It is quite a bit difficult to me to understand all of this.

I will buy an ADSI programming/reference Book, and in a near future, perhaps i will post some articles of mine.

Mean while, i still have other questions.

I will start new threads, and i invite you all to read them.

MAY THE FORCE ALWAYS BE WITH US!

Reply With Quote
  #15  
Old May 17th, 2002, 02:54 AM
Nigorr Nigorr is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Brisbane, Australia
Posts: 78 Nigorr User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 16
What about NDS?? (Novell Directory Server) Got any idea how I could get stuff out of it about users.

I'm making a ASP.NET/C# Intranet App, it is basically a request form, but I want to make it easier for the user and get the info for them, plus it stops them fu****g up the database when they spell stuff wrong.

Reply With Quote
  #16  
Old May 17th, 2002, 03:31 AM
James Yang James Yang is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Atlanta, Georgia
Posts: 284 James Yang User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 45 sec
Reputation Power: 16
Send a message via ICQ to James Yang
ADSI Handles NDS for you as well.

you just need to change the adsipath. refer to MSDN for more detail on the adsipath string

Im not very familiar with novelle so i can't show you how to do it. But i know that it's very similar to accessing AD if not the same...

Reply With Quote
  #17  
Old May 19th, 2002, 06:38 PM
Nigorr Nigorr is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Brisbane, Australia
Posts: 78 Nigorr User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 16
thanks for that I thought it might be a good idea if I visited the Novell site first and it appears that they an ODBC drive to access the directory so I'll have a play with that first and if it doesn't work properly I'll head on over to MSDN.

Reply With Quote
  #18  
Old January 22nd, 2004, 08:38 PM
DingDuck DingDuck is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 1 DingDuck User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi Nigorr

Can I know if that solution worked?
If it did, can I have the link to the Novell website?
I'm hoping to do the same thing over at my workplace.
Thanks

Regards
iain

Reply With Quote
  #19  
Old September 22nd, 2004, 03:40 AM
magnre magnre is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 1 magnre User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Exclamation No Active Directory in NT4

The question was about getting groups etc in NT4, As far as I know there is still no Active Directory in an NT4 domain, only if the server holding the useraccounts is an Windows 2000 Server ...

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingASP Development > Asp + Nt4 + User + Groups


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap