Share via


WebSecurity.IsAccountLockedOut Method (String, Int32, Int32)

Returns a value that indicates whether the specified membership account is temporarily locked because of too many failed password attempts in the specified number of seconds.

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

Syntax

'Declaration
Public Shared Function IsAccountLockedOut ( _
    userName As String, _
    allowedPasswordAttempts As Integer, _
    intervalInSeconds As Integer _
) As Boolean
'Usage
Dim userName As String 
Dim allowedPasswordAttempts As Integer 
Dim intervalInSeconds As Integer 
Dim returnValue As Boolean 

returnValue = WebSecurity.IsAccountLockedOut(userName, _
    allowedPasswordAttempts, intervalInSeconds)
public static bool IsAccountLockedOut(
    string userName,
    int allowedPasswordAttempts,
    int intervalInSeconds
)
public:
static bool IsAccountLockedOut(
    String^ userName, 
    int allowedPasswordAttempts, 
    int intervalInSeconds
)
static member IsAccountLockedOut : 
        userName:string * 
        allowedPasswordAttempts:int * 
        intervalInSeconds:int -> bool
public static function IsAccountLockedOut(
    userName : String, 
    allowedPasswordAttempts : int, 
    intervalInSeconds : int
) : boolean

Parameters

  • userName
    Type: System.String
    The user name of the membership account.
  • allowedPasswordAttempts
    Type: System.Int32
    The number of password attempts the user is permitted before the membership account is locked.
  • intervalInSeconds
    Type: System.Int32
    The number of seconds to lock a user account after the number of password attempts exceeds the value in the allowedPasswordAttempts parameter.

Return Value

Type: System.Boolean
true if the membership account is locked; otherwise, false.

Exceptions

Exception Condition
InvalidOperationException

The SimpleMembershipProvider.Initialize(String, NameValueCollection) method was not called.

-or-

The InitializeDatabaseConnection() method was not called.

-or-

The SimpleMembershipProvider membership provider is not registered in the configuration of your site. For more information, contact your site's system administrator.

See Also

Reference

WebSecurity Class

IsAccountLockedOut Overload

WebMatrix.WebData Namespace