This documentation is archived and is not being maintained.

How to: Determine if a User is in a Group

You can use the My.User object to get information about the current user. This example shows how to use the My.User.IsInRole method to determine if the user is a member of a particular group.

This example uses the My.User.IsInRole method to determine if the user is an administrator before accessing a resource.

If My.User.IsInRole( _
        ApplicationServices.BuiltInRole.Administrator) Then 
    ' Insert code to access a resource here. 
End If
Show: