UserManager<TUser, TKey>.SetTwoFactorEnabledAsync Method

Sets the two factor authentication enabled property for the user.

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

Syntax

'Declaration
Public Overridable Function SetTwoFactorEnabledAsync ( _
    userId As TKey, _
    enabled As Boolean _
) As Task(Of IdentityResult)
'Usage
Dim instance As UserManager 
Dim userId As TKey
Dim enabled As Boolean 
Dim returnValue As Task(Of IdentityResult)

returnValue = instance.SetTwoFactorEnabledAsync(userId, _
    enabled)
public virtual Task<IdentityResult> SetTwoFactorEnabledAsync(
    TKey userId,
    bool enabled
)
public:
virtual Task<IdentityResult^>^ SetTwoFactorEnabledAsync(
    TKey userId, 
    bool enabled
)
abstract SetTwoFactorEnabledAsync : 
        userId:'TKey * 
        enabled:bool -> Task<IdentityResult> 
override SetTwoFactorEnabledAsync : 
        userId:'TKey * 
        enabled:bool -> Task<IdentityResult> 
public function SetTwoFactorEnabledAsync(
    userId : TKey, 
    enabled : boolean
) : Task<IdentityResult>

Parameters

  • userId
    Type: TKey
    The user ID.
  • enabled
    Type: System.Boolean
    true to set two factor authentication; otherwise, false.

Return Value

Type: System.Threading.Tasks.Task<IdentityResult>
The task representing the asynchronous operation.

See Also

Reference

UserManager<TUser, TKey> Class

Microsoft.AspNet.Identity Namespace

Other Resources

ASP.NET Identity