Share via


UserManagerExtensions.SetLockoutEnabled<TUser, TKey> Method

Sets whether the user allows lockout.

Namespace:  Microsoft.AspNet.Identity
Assembly:  Microsoft.AspNet.Identity.Core (in Microsoft.AspNet.Identity.Core.dll)

Syntax

public static IdentityResult SetLockoutEnabled<TUser, TKey>(
    this UserManager<TUser, TKey> manager,
    TKey userId,
    bool enabled
)
where TUser : class, Object, IUser<TKey>
where TKey : Object, IEquatable<TKey>

Type Parameters

  • TUser
    The type of the user.
  • TKey
    The type of the key.

Parameters

  • userId
    Type: TKey
    The user ID.
  • enabled
    Type: System.Boolean
    true to enable the lockout; otherwise, false.

Return Value

Type: Microsoft.AspNet.Identity.IdentityResult
The result of the operation.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type UserManager<TUser, TKey>. When you use instance method syntax to call this method, omit the first parameter. For more information, see https://msdn.microsoft.com/en-us/library/bb384936(v=vs.108) or https://msdn.microsoft.com/en-us/library/bb383977(v=vs.108).

See Also

Reference

UserManagerExtensions Class

Microsoft.AspNet.Identity Namespace

Other Resources

ASP.NET Identity