473,653 Members | 2,972 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Enumerate members of a group in vb.net codebehind pages...

Hello!

I need to get a list of all members of a specific group (whether or not the currently logged-in user is a member of that group) in a VB.NET codebehind page.

I am able to get all the information on the currently logged-in user (full name, phone number, e-mail address, etc.), but I cannot get my head around the filters needed to get membership in a group.

Here is what I have so far:

Public Function GetSalesGroup()
Dim search As DirectorySearch er = New DirectorySearch er(_path)
search.Filter = "(cn=Sales) "
search.Properti esToLoad.Add("g roup")
Dim groupNames As StringBuilder = New StringBuilder

Try
Dim result As SearchResult = search.FindOne( )
Dim propertyCount As Integer = result.Properti es("memberOf"). Count

Dim dn As String
Dim equalsIndex, commaIndex

Dim propertyCounter As Integer

For propertyCounter = 0 To propertyCount - 1
dn = CType(result.Pr operties("membe rOf")(propertyC ounter), String)

equalsIndex = dn.IndexOf("=", 1)
commaIndex = dn.IndexOf(",", 1)
If (equalsIndex = -1) Then
Return Nothing
End If

groupNames.Appe nd(dn.Substring ((equalsIndex + 1), (commaIndex - equalsIndex) - 1))
groupNames.Appe nd("|")
Next

Catch ex As Exception
Throw New Exception("Erro r obtaining Sales group membership. " & ex.Message & "<br>")
End Try

Return groupNames.ToSt ring()
End Function

The results of this are supposed to be thrown to a session variable upon return.

Help!

Thanks!

SteveO

--
Message posted via http://www.dotnetmonster.com
Nov 19 '05 #1
2 1489
....bounce...

Anyone?

--
Message posted via http://www.dotnetmonster.com
Nov 19 '05 #2
> Anyone?

I'm anyone!

BTW, that's "bump," and it really helps to repeat the question for those of
us that hide read messages in our newsgroup client.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"Steve Oswald via DotNetMonster.c om" <fo***@DotNetMo nster.com> wrote in
message news:55******** *************** *******@DotNetM onster.com...
...bounce...

Anyone?

--
Message posted via http://www.dotnetmonster.com

Nov 19 '05 #3

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

Similar topics

6
2848
by: Thomas Connolly | last post by:
I have 2 pages referencing the same codebehind file in my project. Originally the pages referenced separate code behind files. Once I changed the reference to the same file, everything worked fine while the file was in the project directory. When the obsolete file was removed from the project directory, my application will no longer compile. Can someone please help with this issue? Thank in advance, Tom
3
4422
by: shiv | last post by:
Hi all, I am able to read groups in the domain but not able to read the members within each group. can somebody help? here goes the code DirectoryEntry m_obDirEntry=new DirectoryEntry ("LDAP://mydomain"); SearchResultCollection results;
3
1578
by: nevets2001uk | last post by:
Hi. I've just started my second ASP.NET (VB) app and I'm using codebehind this time. I'm not using visual studio but am instead coding it all in notepad (HTML, ASP.NET and CSS) I'm trying to understand how to best use codebehind to do what I want to achieve. Basically, so far I have a codebehind file for one page which works as I wanted but I want other pages to share that codebehind file. That's no problem except I want each one to...
6
2334
by: Plamen Doykov | last post by:
Hi all I have converted a simple project from ASP.NET 1 to 2.0 with the latest prerelease of Visual Studio 2005. The problem is I can't access internal members from the code behind. It gives: error CS0122: 'Class' is inaccessible due to its protection level This happens only when access members from code behind, not from the other classes. It compiles OK when making the class and its members public. However, I don't want to do that....
23
12354
by: BH Jodo Kast | last post by:
Hi, I found this handy script and I'm trying to convert it to VB.NET. It pops up a list of members in the Administrators/Builtin group. Can't seem to get DirectorySearcher or DirectoryEntry working similar to this. Run this as a VBS script to see: Option Explicit Dim strUser, strMember, strDNSDomain, strContainer Dim objGroup, objUser, objRootDSE
1
5887
by: ginolard | last post by:
I'm trying to find out how to enumerate all local groups on a machine and list their membership. It's easy in Vbscript but it seems to be considerably more tricky in VB.NET. Am I missing something obvious?
6
1555
by: antonyliu2002 | last post by:
Right now I put my VB code in the aspx pages. I would prefer to use codebehind, especially many of my VB functions may be shared across multiple aspx pages. I've tried a few pages with codebehind by follwing some examples on the Web and they work just fine. However, I am scared away from codebehind by such extenstions as "Handles MyBase.Load", "Handles Button1.Click" and "Handles MyBase.Init" etc. which we seem to have to add to the...
0
2500
by: bcanter | last post by:
I found a file on the web that will allow you to enumerate groups but it was an .hta and the top level admins won't allow this. I need to give managers access to the groups so that when a new user is created they can tell me who they want their account to be modeled after. The html app works great as a .hta file but when it is saved as a web page it won't list the members of any groups. I get an error on line 182: "ActiveX component can't create...
2
12624
by: =?Utf-8?B?am1hZ2FyYW0=?= | last post by:
I'm trying to get a list of user accounts on the local computer - the same list you see when you are about to log in to Windows XP or Vista. This needs to work on a home computer (not connected to a domain). It's for a parental control app where I want the parent to be able to assign rules for each child's account. I've tried using the Win32 API LsaEnumerateAccountsWithUserRight with the SE_INTERACTIVE_LOGON_NAME privilege, but it doesn't...
0
8370
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8811
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8470
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7302
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6160
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5620
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4291
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1914
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1591
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.