可以使用 My.User 对象来获取有关当前用户的信息。 此示例演示如何使用 My.User.IsInRole 方法确定用户是否为特定组的成员。
示例
此示例使用 My.User.IsInRole 方法确定用户在访问资源之前是否为管理员。
If My.User.IsInRole(
ApplicationServices.BuiltInRole.Administrator) Then
' Insert code to access a resource here.
End If
请参见
任务
演练:实现自定义身份验证和授权 (Visual Basic)