Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

WebSecurity CreateAccount Method

WebSecurity - CreateAccount()


WebSecurity Object WebSecurity object


define

CreateAccount() The method uses a username and password to create a new account in the user database, and can optionally specify whether the user must explicitly confirm the account.


C# and VB syntax

WebSecurity.CreateAccount(

username, password, requireConfirmation

)


Parameters

Parameters Type Description
userName String Username
password String The user's password
requireConfirmation Boolean Returns the token used to confirm the account if confirmation is required true. By default it returns false。

Return Value

Type Description
String a token that can be sent to the user for account confirmation.

Errors and exceptions

In the following cases, any access to the WebSecurity object will throw an InvalidOperationException:

In the following cases,CreateAccount() the method also throws an MembershipCreateUserException:


Technical data

Name Value
Namespace WebMatrix.WebData
Assembly WebMatrix.WebData.dll

WebSecurity Object WebSecurity object