Simple way to make sure user is in a Group

This is very simple, no need to re-authenticate to do this. I used this to make sure that the user is in a group to give access to this option.

User has to be in Group := “Domain”\Plant Supervisors


Import System.Security.Principal

Dim curUser As New Security.Principal.WindowsPrincipal(Security.Principal.WindowsIdentity.GetCurrent)

If curUser.IsInRole(Environment.UserDomainName & "\Plant Supervisors") = True Then

'Do what ever
Else
'Do whatever
End if

Enjoy!