Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.††If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Display Modes
  #1 (permalink)  
Old June 2nd, 2004, 05:53 AM
Authorized User
Join Date: Jun 2004
Location: , , .
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default Forms Authentication - Groups

Hi everyone!
I am using the article http://msdn.microsoft.com/library/en...asp?frame=true to implement authentication with the active directory. Everything works fine - the user is authenticated but when it comes to retrieving the groups that the user is in, the group "Domain Users" is never returned. The other groups that the user is part of are brought back. The group names are printed onto the form separated using |. The member of property is used to retrieve the groups. When i look at the users profile in the active directory the groups that the user is part of are in the member of tab. Domain Users is here and so are all the other groups for that user but all groups are printed on the screen except for domain users. Sorry if something like this has been posted already but when i searched for it i couldnt fins anything similar.

This is the procedure that is used to get the groups that the user currently logged in is part of:

public string GetGroups()
DirectorySearcher search = new DirectorySearcher(_path);
search.Filter = "(cn=" + _filterAttribute + ")";
StringBuilder groupNames = new StringBuilder();


SearchResult result = search.FindOne();

int propertyCount = result.Properties["memberOf"].Count;
groupNames.Append("propertyCount: "+propertyCount+"<BR>");

String dn;

int equalsIndex, commaIndex;

for( int propertyCounter = 0; propertyCounter < propertyCount;

dn = (String)result.Properties["memberOf"][propertyCounter];
equalsIndex = dn.IndexOf("=", 1);
commaIndex = dn.IndexOf(",", 1);
      if (-1 == equalsIndex)

      return null;

groupNames.Append(dn.Substring((equalsIndex + 1),
(commaIndex - equalsIndex) - 1)+"<BR>");


catch(Exception ex)
throw new Exception("Error obtaining group names. " +

Reply With Quote
  #2 (permalink)  
Old June 2nd, 2004, 10:02 AM
Friend of Wrox
Points: 3,489, Level: 24
Points: 3,489, Level: 24 Points: 3,489, Level: 24 Points: 3,489, Level: 24
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Central, NJ, USA.
Posts: 1,102
Thanks: 0
Thanked 2 Times in 2 Posts

Everyone who is a validated user is a member of domain users. I don't belive it's reported- just like it's not reported that the user is a memeber of the "Everyone" group.

Hal Levy
Web Developer, PDI Inc.

NOT a Wiley/Wrox Employee
Reply With Quote

Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Forms Authentication thetway Classic ASP Basics 1 August 18th, 2005 06:55 PM

All times are GMT -4. The time now is 02:33 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.