471,338 Members | 863 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Getting Groups of a User in a Domain

Hi All,
I'm trying to get the "groups" of a user that belongs to a domain by
just passing the user's userID & domain. Is this possible?

What I tried, and is working is the ff code ( i can get both local &
domain groups), but in Windows Application.

When I tried converting it to ASP.NET, it only gets the local
groups.

Dim id As WindowsIdentity = WindowsIdentity.GetCurrent()

Dim idType As Type
idType = GetType(WindowsIdentity)
Dim result As Object = idType.InvokeMember("_GetRoles",
BindingFlags.Static Or BindingFlags.InvokeMethod Or
BindingFlags.NonPublic, Nothing, id, New Object() {id.Token}, Nothing)
Dim roles() As String = DirectCast(result, String())

Dim i As Integer
Do Until i = roles.GetUpperBound(0)
Me.tbxAPI.Text = Me.tbxAPI.Text & roles(i) & vbCrLf
i = i + 1
Loop

Anyone knows how to make the code above possible in ASP.NET?
Maybe i just need to configure my IIS?

Pls help.

Thanks,
Henry :)

P.S. I'm a newbie in ASP.NET :)

Nov 19 '05 #1
5 1754
Henry,

You need to set <identity impersonate="true"/> in the application's
web.config file and also set the website to use windows integrated security
in IIS.
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
<he***********@gmail.com> wrote in message
news:11*********************@g47g2000cwa.googlegro ups.com...
Hi All,
I'm trying to get the "groups" of a user that belongs to a domain by
just passing the user's userID & domain. Is this possible?

What I tried, and is working is the ff code ( i can get both local &
domain groups), but in Windows Application.

When I tried converting it to ASP.NET, it only gets the local
groups.

Dim id As WindowsIdentity = WindowsIdentity.GetCurrent()

Dim idType As Type
idType = GetType(WindowsIdentity)
Dim result As Object = idType.InvokeMember("_GetRoles",
BindingFlags.Static Or BindingFlags.InvokeMethod Or
BindingFlags.NonPublic, Nothing, id, New Object() {id.Token}, Nothing)
Dim roles() As String = DirectCast(result, String())

Dim i As Integer
Do Until i = roles.GetUpperBound(0)
Me.tbxAPI.Text = Me.tbxAPI.Text & roles(i) & vbCrLf
i = i + 1
Loop

Anyone knows how to make the code above possible in ASP.NET?
Maybe i just need to configure my IIS?

Pls help.

Thanks,
Henry :)

P.S. I'm a newbie in ASP.NET :)

Nov 19 '05 #2
Hi Justin,
It worked, i just
1) Added <identity impersonate="true"/> at the web config
2) Checked ONLY windows integrated security

Thanks so much.

Last question though, how can i get the same result if i want to check
the Anonymous selection at the IIS Direcotry Security?

When I checked it, it only gets the "entered" user's groupings, but
what we want is the "client/current" user's groups.

Thanks,
Henry :)
S. Justin Gengo wrote:
Henry,

You need to set <identity impersonate="true"/> in the application's
web.config file and also set the website to use windows integrated security
in IIS.
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
<he***********@gmail.com> wrote in message
news:11*********************@g47g2000cwa.googlegro ups.com...
Hi All,
I'm trying to get the "groups" of a user that belongs to a domain by
just passing the user's userID & domain. Is this possible?

What I tried, and is working is the ff code ( i can get both local &
domain groups), but in Windows Application.

When I tried converting it to ASP.NET, it only gets the local
groups.

Dim id As WindowsIdentity = WindowsIdentity.GetCurrent()

Dim idType As Type
idType = GetType(WindowsIdentity)
Dim result As Object = idType.InvokeMember("_GetRoles",
BindingFlags.Static Or BindingFlags.InvokeMethod Or
BindingFlags.NonPublic, Nothing, id, New Object() {id.Token}, Nothing)
Dim roles() As String = DirectCast(result, String())

Dim i As Integer
Do Until i = roles.GetUpperBound(0)
Me.tbxAPI.Text = Me.tbxAPI.Text & roles(i) & vbCrLf
i = i + 1
Loop

Anyone knows how to make the code above possible in ASP.NET?
Maybe i just need to configure my IIS?

Pls help.

Thanks,
Henry :)

P.S. I'm a newbie in ASP.NET :)


Nov 19 '05 #3
Henry,

Would you be able to explain your last request with different wording and/or
more detail. I'm afraid I'm not understanding exactly what you need.

Thanks,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
<he***********@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
Hi Justin,
It worked, i just
1) Added <identity impersonate="true"/> at the web config
2) Checked ONLY windows integrated security

Thanks so much.

Last question though, how can i get the same result if i want to check
the Anonymous selection at the IIS Direcotry Security?

When I checked it, it only gets the "entered" user's groupings, but
what we want is the "client/current" user's groups.

Thanks,
Henry :)
S. Justin Gengo wrote:
Henry,

You need to set <identity impersonate="true"/> in the application's
web.config file and also set the website to use windows integrated
security
in IIS.
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
<he***********@gmail.com> wrote in message
news:11*********************@g47g2000cwa.googlegro ups.com...
> Hi All,
> I'm trying to get the "groups" of a user that belongs to a domain by
> just passing the user's userID & domain. Is this possible?
>
> What I tried, and is working is the ff code ( i can get both local &
> domain groups), but in Windows Application.
>
> When I tried converting it to ASP.NET, it only gets the local
> groups.
>
> Dim id As WindowsIdentity = WindowsIdentity.GetCurrent()
>
> Dim idType As Type
> idType = GetType(WindowsIdentity)
> Dim result As Object = idType.InvokeMember("_GetRoles",
> BindingFlags.Static Or BindingFlags.InvokeMethod Or
> BindingFlags.NonPublic, Nothing, id, New Object() {id.Token}, Nothing)
> Dim roles() As String = DirectCast(result, String())
>
> Dim i As Integer
> Do Until i = roles.GetUpperBound(0)
> Me.tbxAPI.Text = Me.tbxAPI.Text & roles(i) & vbCrLf
> i = i + 1
> Loop
>
> Anyone knows how to make the code above possible in ASP.NET?
> Maybe i just need to configure my IIS?
>
> Pls help.
>
> Thanks,
> Henry :)
>
> P.S. I'm a newbie in ASP.NET :)
>

Nov 19 '05 #4
Hi Justin,
Under the Authentication Methods Dialog Box, there is a Anonymous
Access Check Box. I would like to have this "Checked" and at the same
time make the "Get User Groupings" function work.

I tried checking this checkbox and running the webpage and what the
"Get User Groupings" function got was the groupings of
IUSR_"MACHINENAME".

Any configuration I can do to allow Anonymous Access, and have my
website "Get User Groupings" of the domain/client browsing?

Thanks,
Henry :)
S. Justin Gengo wrote:
Henry,

Would you be able to explain your last request with different wording and/or
more detail. I'm afraid I'm not understanding exactly what you need.

Thanks,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
<he***********@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
Hi Justin,
It worked, i just
1) Added <identity impersonate="true"/> at the web config
2) Checked ONLY windows integrated security

Thanks so much.

Last question though, how can i get the same result if i want to check
the Anonymous selection at the IIS Direcotry Security?

When I checked it, it only gets the "entered" user's groupings, but
what we want is the "client/current" user's groups.

Thanks,
Henry :)
S. Justin Gengo wrote:
Henry,

You need to set <identity impersonate="true"/> in the application's
web.config file and also set the website to use windows integrated
security
in IIS.
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
<he***********@gmail.com> wrote in message
news:11*********************@g47g2000cwa.googlegro ups.com...
> Hi All,
> I'm trying to get the "groups" of a user that belongs to a domain by
> just passing the user's userID & domain. Is this possible?
>
> What I tried, and is working is the ff code ( i can get both local &
> domain groups), but in Windows Application.
>
> When I tried converting it to ASP.NET, it only gets the local
> groups.
>
> Dim id As WindowsIdentity = WindowsIdentity.GetCurrent()
>
> Dim idType As Type
> idType = GetType(WindowsIdentity)
> Dim result As Object = idType.InvokeMember("_GetRoles",
> BindingFlags.Static Or BindingFlags.InvokeMethod Or
> BindingFlags.NonPublic, Nothing, id, New Object() {id.Token}, Nothing)
> Dim roles() As String = DirectCast(result, String())
>
> Dim i As Integer
> Do Until i = roles.GetUpperBound(0)
> Me.tbxAPI.Text = Me.tbxAPI.Text & roles(i) & vbCrLf
> i = i + 1
> Loop
>
> Anyone knows how to make the code above possible in ASP.NET?
> Maybe i just need to configure my IIS?
>
> Pls help.
>
> Thanks,
> Henry :)
>
> P.S. I'm a newbie in ASP.NET :)
>


Nov 19 '05 #5
Henry,

You would have to create an account to get the groupings with.

I found an impersonation tutorial which is technically for sharepoint. But
the article shows how to create an "Impersonator" class which it will be
helpful for you to look at. Even though this is geared toward sharepoint
what's being done is the same as you want to do:

http://www.15seconds.com/issue/040511.htm

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
<he***********@gmail.com> wrote in message
news:11*********************@g43g2000cwa.googlegro ups.com...
Hi Justin,
Under the Authentication Methods Dialog Box, there is a Anonymous
Access Check Box. I would like to have this "Checked" and at the same
time make the "Get User Groupings" function work.

I tried checking this checkbox and running the webpage and what the
"Get User Groupings" function got was the groupings of
IUSR_"MACHINENAME".

Any configuration I can do to allow Anonymous Access, and have my
website "Get User Groupings" of the domain/client browsing?

Thanks,
Henry :)
S. Justin Gengo wrote:
Henry,

Would you be able to explain your last request with different wording
and/or
more detail. I'm afraid I'm not understanding exactly what you need.

Thanks,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
<he***********@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
> Hi Justin,
> It worked, i just
> 1) Added <identity impersonate="true"/> at the web config
> 2) Checked ONLY windows integrated security
>
> Thanks so much.
>
> Last question though, how can i get the same result if i want to check
> the Anonymous selection at the IIS Direcotry Security?
>
> When I checked it, it only gets the "entered" user's groupings, but
> what we want is the "client/current" user's groups.
>
> Thanks,
> Henry :)
>
>
> S. Justin Gengo wrote:
>> Henry,
>>
>> You need to set <identity impersonate="true"/> in the application's
>> web.config file and also set the website to use windows integrated
>> security
>> in IIS.
>>
>>
>> --
>> Sincerely,
>>
>> S. Justin Gengo, MCP
>> Web Developer / Programmer
>>
>> www.aboutfortunate.com
>>
>> "Out of chaos comes order."
>> Nietzsche
>> <he***********@gmail.com> wrote in message
>> news:11*********************@g47g2000cwa.googlegro ups.com...
>> > Hi All,
>> > I'm trying to get the "groups" of a user that belongs to a domain
>> > by
>> > just passing the user's userID & domain. Is this possible?
>> >
>> > What I tried, and is working is the ff code ( i can get both local
>> > &
>> > domain groups), but in Windows Application.
>> >
>> > When I tried converting it to ASP.NET, it only gets the local
>> > groups.
>> >
>> > Dim id As WindowsIdentity = WindowsIdentity.GetCurrent()
>> >
>> > Dim idType As Type
>> > idType = GetType(WindowsIdentity)
>> > Dim result As Object = idType.InvokeMember("_GetRoles",
>> > BindingFlags.Static Or BindingFlags.InvokeMethod Or
>> > BindingFlags.NonPublic, Nothing, id, New Object() {id.Token},
>> > Nothing)
>> > Dim roles() As String = DirectCast(result, String())
>> >
>> > Dim i As Integer
>> > Do Until i = roles.GetUpperBound(0)
>> > Me.tbxAPI.Text = Me.tbxAPI.Text & roles(i) & vbCrLf
>> > i = i + 1
>> > Loop
>> >
>> > Anyone knows how to make the code above possible in ASP.NET?
>> > Maybe i just need to configure my IIS?
>> >
>> > Pls help.
>> >
>> > Thanks,
>> > Henry :)
>> >
>> > P.S. I'm a newbie in ASP.NET :)
>> >
>

Nov 19 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by uiranejeb | last post: by
4 posts views Thread by Ben Dewey | last post: by
11 posts views Thread by Derek Martin | last post: by
5 posts views Thread by Rocky | last post: by
10 posts views Thread by Jeff Williams | last post: by
reply views Thread by rosydwin | last post: by

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.