Easy Tutorial
❮ Aspnet Repeater Control Imagebutton ❯

WebSecurity - CreateUserAndAccount()


Definition

The CreateUserAndAccount() method creates a new account in the user database with a username and password, and can optionally specify whether the user must explicitly confirm the account.


C# and VB Syntax


Parameters

Parameter Type Description
userName String The username
password String The user's password
propertyValues Object A dictionary containing additional user properties
requireConfirmation Boolean Returns true if the account must be confirmed using a token return value. Defaults to false.

Return Value

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

Remarks

The CreateUserAndAccount() method creates a new entry in the user profile table in the WebSecurity database, and then creates a matching entry in the membership table.

You can pass true for the parameter to require that the account must be confirmed by the user. To confirm the account, you must obtain the token as a return value from the CreateUserAndAccount() method.

If you want to manually maintain the user profile table and only want to create an entry in the membership table for the user, call the CreateAccount() method.


Errors and Exceptions

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

In the following cases, the CreateUserAndAccount() method will also throw a MembershipCreateUserException:


Technical Data

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

❮ Aspnet Repeater Control Imagebutton ❯