You can use IsInRole() method to evaluate whether a user is a member of a group.   This method accepts the role name as a string name and returns true if the user is a member of that role.

You can use the next code to check if the current user is a member of the Supplier role:

If User.IsInRole(“Supplier”) Then

‘ Do nothing, the page should be accessed as normal because the

‘ user has administrator privileges.

Else

‘ Don’t allow this page. Instead, redirect to the home page.

Response.Redirect(“Default.aspx”)

End If

When you are using Windows authentication, you need to use the format DomainName\GroupName or ComputerName\GroupName.

If User.IsInRole(“THEDOMAIN\ Supplier”) Then

‘ ….

Else

‘…

End If

This approach works for custom groups you’ve created but not for built-in groups that are defined by the operating system. If you want to check whether a user is a member of one of the built-in groups, you use this syntax:

If User.IsInRole(“BUILTIN\Administrators”) Then

‘ ….

Else

‘…

End If