TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
iftachs
NA
3
0
List Of Domains
Mar 1 2005 6:13 AM
Hi, I am trying to list out the domains on the server using System.DirectoryServices. It gives domains, but list contains only one domain name. Our server has more that 3 domains and subdomains. The code which i am using is as follows. private StringCollection GetDomainList() { StringCollection domainList = new StringCollection(); try { DirectoryEntry en = new DirectoryEntry("WinNT://"); // Search for objectCategory type "Domain" DirectorySearcher srch = new DirectorySearcher("objectCategory=Domain"); SearchResultCollection coll = srch.FindAll(); // Enumerate over each returned domain. foreach (SearchResult rs in coll) { ResultPropertyCollection resultPropColl = rs.Properties; foreach( object domainName in resultPropColl["name"]) { domainList.Add(domainName.ToString()); } } } catch (Exception ex) { Trace.Write(ex.Message); } return domainList; } Is it the correct way to list the domains? It is giving only the domain name in which i am a user and i log in with this user. This domain has subdomains and also along with this other domains are also there. Can you please help out? Thanx Iftach
Reply
Answers (
0
)
creating a graphics object to pass into a paint method
How can I convert the collection object to an int?