|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
Determines whether the current user belongs to the specified role.
' Usage Dim value As Boolean = My.User.IsInRole(role) Dim value As Boolean = My.User.IsInRole(role) ' Declaration Public Function IsInRole( _ ByVal role As String _ ) As Boolean ' -or- Public Function IsInRole( _ ByVal role As BuiltInRole _ ) As Boolean
String or. The role for which to check membership.
The My.User.IsInRole method allows your code to determine if the current user is a member of the specified role.
The overload of the My.User.IsInRole method that takes a string provides easy access to themethod of the current principal.
The overload of the My.User.IsInRole method that takes a BuiltInRole enumeration behaves differently, depending on the current principal. If it is a Windows user principal (role to the equivalent enumeration and returns the result of calling . If the current principal is any other principal, this function passes the name of the enumeration value in role to the principal's IsInRole method.), this function converts
The exact behavior of the My.User object depends on the type of the application and on the operating system on which the application runs. For more information, see.