WebSecurity.ConfirmAccount Method (String, String)
Confirms that an account for the specified user name is valid and activates the account.
Namespace: WebMatrix.WebData
Assembly: WebMatrix.WebData (in WebMatrix.WebData.dll)
Syntax
'Declaration
Public Shared Function ConfirmAccount ( _
userName As String, _
accountConfirmationToken As String _
) As Boolean
'Usage
Dim userName As String
Dim accountConfirmationToken As String
Dim returnValue As Boolean
returnValue = WebSecurity.ConfirmAccount(userName, _
accountConfirmationToken)
public static bool ConfirmAccount(
string userName,
string accountConfirmationToken
)
public:
static bool ConfirmAccount(
String^ userName,
String^ accountConfirmationToken
)
static member ConfirmAccount :
userName:string *
accountConfirmationToken:string -> bool
public static function ConfirmAccount(
userName : String,
accountConfirmationToken : String
) : boolean
Parameters
- userName
Type: System.String
The user name.
- accountConfirmationToken
Type: System.String
A confirmation token to pass to the authentication provider.
Return Value
Type: System.Boolean
true if the account is confirmed; 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. |
Remarks
The confirmation token is generated by the CreateAccount(String, String, Boolean), CreateUserAndAccount(String, String, Object, Boolean), and GeneratePasswordResetToken(String, Int32) methods. The token is ordinarily sent to the user as a link in an email message, and the user clicks the link in order to verify his or her identity.