Share via


My.User.IsAuthenticated Property 

Gets a value that indicates whether the user has been authenticated.

' Usage
Dim value As Boolean = My.User.IsAuthenticated
' Declaration
Public ReadOnly Property IsAuthenticated As Boolean

Return Value

True if the user was authenticated; otherwise, False.

Remarks

The My.User.IsAuthenticated property allows your code to determine if the current user has been authenticated.

Note

The exact behavior of My.User object depends on the type of the application and on the operating system on which the application runs. For more information, see My.User Object.

Tasks

To See

Implement custom authentication

Walkthrough: Implementing Custom Authentication and Authorization

Example

This example verifies that the user has been authenticated before accessing a resource.

If My.User.IsAuthenticated Then
    ' Insert code to access a resource here.
End If

Requirements

Namespace: Microsoft.VisualBasic.ApplicationServices

Class: User, WebUser

Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)

Availability by Project Type

Project type Available

Windows Application

Yes

Class Library

Yes

Console Application

Yes

Windows Control Library

Yes

Web Control Library

Yes

Windows Service

Yes

Web Site

Yes

Permissions

The following permission may be necessary:

Permission Description

SecurityPermission

Describes a set of security permissions applied to code. Associated enumeration: ControlPrincipal.

For more information, see Code Access Security and Requesting Permissions.

See Also

Tasks

Walkthrough: Implementing Custom Authentication and Authorization

Reference

My.User Object
Microsoft.VisualBasic.ApplicationServices.User.IsAuthenticated