WebSecurity.IsAuthenticated Property

Gets the authentication status of the current user.

Namespace:  WebMatrix.WebData
Assembly:  WebMatrix.WebData (in WebMatrix.WebData.dll)

Public Shared ReadOnly Property IsAuthenticated As Boolean
Dim value As Boolean

value = WebSecurity.IsAuthenticated

Property Value

Type: System.Boolean
true if the current user is authenticated; otherwise, false. The default is false.

The following example shows how to use the IsAuthenticated method to verify that the current user is authenticated.

if (!WebSecurity.IsAuthenticated)
    // If this page is accessed before the user logs in, notify the user.
    <p>You must first log in to access the rest of this page.</p>
    <p>Click <a href="WebSecurityLogin.cshtml">here</a> to log in.</p>

  • Medium trust for the immediate caller. This member can be used by partially trusted code.