Export (0) Print
Expand All

SimpleMembershipProvider.CreateAccount Method (String, String, Boolean)

Creates a new user account by using the specified user name and password.

Namespace:  WebMatrix.WebData
Assembly:  WebMatrix.WebData (in WebMatrix.WebData.dll)

'Declaration
Public Overrides Function CreateAccount ( _
	userName As String, _
	password As String, _
	requireConfirmationToken As Boolean _
) As String
'Usage
Dim instance As SimpleMembershipProvider
Dim userName As String
Dim password As String
Dim requireConfirmationToken As Boolean
Dim returnValue As String

returnValue = instance.CreateAccount(userName, _
	password, requireConfirmationToken)

Parameters

userName
Type: System.String
The user name.
password
Type: System.String
The password.
requireConfirmationToken
Type: System.Boolean
(Optional) true to specify that the user account must be confirmed; otherwise, false. The default is false.

Return Value

Type: System.String
A token that can be sent to the user to confirm the user account.

ExceptionCondition
MembershipCreateUserException

username is empty.

-or-

username already has a user account.

-or-

password is empty.

-or-

password is longer than 128 characters.

-or-

A user record that corresponds to username does not exist in the UserTableName table (the user profile table).

-or-

The database operation failed.

InvalidOperationException

The SimpleMembershipProvider class was not initialized using a call to the InitializeDatabaseConnection method.

A user account is an entry in the membership table (by default, webpages_Membership). A user account record includes information such as the date that the account was created, the password, the date and time when the password was most recently changed, and so on. The user account table does not contain the user's name or email address; that information is stored instead in a user profile table. When you call the CreateAccount(String, String, Boolean) method, a user record that has the same user name (email address) as the account that you are trying to create must exist in the user profile table.

If the user profile record does not already exist and you want to create the user profile record and the membership account record at the same time, call CreateUserAndAccount(String, String, Boolean, IDictionary(Of String, Object)).

The token that this method returns can be sent to the user as part of a hyperlink that points to a confirmation page in your site. In the confirmation page, you can read the token and call the ConfirmAccount(String) method in order to confirm the account.

  • Medium trust for the immediate caller. This member can be used by partially trusted code.
Show:
© 2014 Microsoft