Share via


WebSecurity.CreateAccount(String, String, Boolean) Method

Definition

Creates a new membership account using the specified user name and password and optionally lets you specify that the user must explicitly confirm the account.

public static string CreateAccount (string userName, string password, bool requireConfirmationToken = false);
static member CreateAccount : string * string * bool -> string
Public Shared Function CreateAccount (userName As String, password As String, Optional requireConfirmationToken As Boolean = false) As String

Parameters

userName
String

The user name.

password
String

The password.

requireConfirmationToken
Boolean

(Optional) true to specify that the account must be confirmed by using the token return value; otherwise, false. The default is false.

Returns

A token that can be sent to the user to confirm the account.

Exceptions

username is empty.-or-username already has a membership account.-or-password is empty.-or-password is too long.-or-The database operation failed.

The 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.

Applies to