Ask a Question related to ASP.NET Security, Design and Development.
-
Reine Olofsson #1
Replacement for NetUserGetLocalGroups with LG_INCLUDE_INDIRECT set
Hi all
I'm trying to implement access check in my web application based on the
current
user.
I've tried using the IsInRole method but have discoverad that it lacks one
important feature. It doens't return TRUE if the user belongs to a domin
group added to the local group i'm checking..
Sample:
User 'MyUser' is a member of DOMAIN\Developers
DOMAIN\Developers is a member of LOCALSERVER\AppUsers
When i run myCredential.IsInRole("LOCALSERVER\AppUsers") the return value is
False. If I add 'MyUser' to LOCALSERVER\AppUsers excplicitly it works, but
that's not an option.
Can I somehow get the funtionality of the NetApi32 function
NetUserGetLocalGroups with the flag LG_INCLUDE:INDIRECT? Does anyone have
any sample code for declaring and using the NetUserGetLocalGroups function
in VB.Net?
Regards
Reine Olofsson
Developer
Reine Olofsson Guest
-
KTML replacement?
Hi guys, I used to work with KTML with my old Dreamweaver. Now I moved on to DW CS3 and KTML doesn't work any more... Do anbybody knows any... -
connectstring replacement
Previously in CF5, we would pass the persons username in the connectstring attribute of cfquery. Then using SQL Profiler for MS SQL Server, we could... -
Media replacement
Our CD went missing how do I optain a new CD? Thanks -
Word replacement
Hi There, How do I read a file and replace all occurences of a word in it with another word. For example, I want to read the file BUS_SCHEDULE... -
text replacement+
Hi everyone, I have a following data to analyze : --------- BlockA color 0 0 0 rcolor 1 1 1 dcolor 2 2 2 BloackB -
Reine Olofsson #2
Re: Replacement for NetUserGetLocalGroups with LG_INCLUDE_INDIRECT set
Problem solved:
Public Function GetLocalRoles(ByRef winIdentity As WindowsIdentity) As
String()
Dim iCount, iMax As Integer
Dim vRoles() As String
Dim sLocalRoles, sLocalServer As String
Dim vLocalRoles() As String
Dim idType As Type
Dim result As Object
sLocalServer = Environment.MachineName.ToUpper
idType = GetType(System.Security.Principal.WindowsIdentity)
result = idType.InvokeMember("_GetRoles", _
BindingFlags.Static Or BindingFlags.InvokeMethod Or
BindingFlags.NonPublic, _
Nothing, winIdentity, New Object() {winIdentity.Token}, Nothing)
vRoles = DirectCast(result, String())
iMax = vRoles.Length - 1
For iCount = 0 To iMax
If vRoles(iCount) <> "" Then
If vRoles(iCount).ToUpper.StartsWith(sLocalServer) Then
sLocalRoles += vRoles(iCount).Remove(0, sLocalServer.Length + 1) +
";"
End If
End If
Next
If sLocalRoles <> "" Then
vLocalRoles = sLocalRoles.Split(";".ToCharArray)
Return vLocalRoles
End If
End Function
/Reine Olofsson
"Reine Olofsson" <reine@faktab.se> wrote in message
news:eHYZFVFcDHA.3620@TK2MSFTNGP11.phx.gbl...is> Hi all
>
> I'm trying to implement access check in my web application based on the
> current
> user.
> I've tried using the IsInRole method but have discoverad that it lacks one
> important feature. It doens't return TRUE if the user belongs to a domin
> group added to the local group i'm checking..
> Sample:
> User 'MyUser' is a member of DOMAIN\Developers
> DOMAIN\Developers is a member of LOCALSERVER\AppUsers
> When i run myCredential.IsInRole("LOCALSERVER\AppUsers") the return value> False. If I add 'MyUser' to LOCALSERVER\AppUsers excplicitly it works, but
> that's not an option.
> Can I somehow get the funtionality of the NetApi32 function
> NetUserGetLocalGroups with the flag LG_INCLUDE:INDIRECT? Does anyone have
> any sample code for declaring and using the NetUserGetLocalGroups function
> in VB.Net?
>
> Regards
> Reine Olofsson
> Developer
>
>
>
Reine Olofsson Guest



Reply With Quote

