Hi ng,
I want to know if a user has admin rightsSo I wrote the following code
to check, if the user is in the admin-group:
Dim bIsInRole as Boolean
Dim myUser As Security.Princi pal.WindowsIden tity =
Principal.Windo wsIdentity.GetC urrent()
Dim myPrincipal As New Principal.Windo wsPrincipal(myU ser)
bIsInRole =
myPrincipal.IsI nRole(Principal .WindowsBuiltIn Role.Administra tor).ToString()
Works fine, but now I have another problem: If the User is not in
admin-group but in another group which belongs to the admins (or has
admin-rights), my code doesn't work.
Does anybody know how I can check if a group belongs to the admins?
Or does anybody know about another way to check, if a user has
admin-rights?
Thanx,
Norman
I want to know if a user has admin rightsSo I wrote the following code
to check, if the user is in the admin-group:
Dim bIsInRole as Boolean
Dim myUser As Security.Princi pal.WindowsIden tity =
Principal.Windo wsIdentity.GetC urrent()
Dim myPrincipal As New Principal.Windo wsPrincipal(myU ser)
bIsInRole =
myPrincipal.IsI nRole(Principal .WindowsBuiltIn Role.Administra tor).ToString()
Works fine, but now I have another problem: If the User is not in
admin-group but in another group which belongs to the admins (or has
admin-rights), my code doesn't work.
Does anybody know how I can check if a group belongs to the admins?
Or does anybody know about another way to check, if a user has
admin-rights?
Thanx,
Norman
Comment