SimpleMembershipProvider.CreateUser Method

Adds the specified user to the membership database.

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

public override function CreateUser(
	username : String, 
	password : String, 
	email : String, 
	passwordQuestion : String, 
	passwordAnswer : String, 
	isApproved : boolean, 
	providerUserKey : Object, 
	status : MembershipCreateStatus
) : MembershipUser


Type: System.String
The user name for the new user account.
Type: System.String
The password for the new user account.
Type: System.String
The email address for the new user account.
Type: System.String
The security question for the new user account.
Type: System.String
The answer to the security question for the new user account.
Type: System.Boolean
true to indicate that the user account is approved to be validated; otherwise, false.
Type: System.Object
The unique identifier from the membership data source for the user account.
Type: System.Web.Security.MembershipCreateStatus%
When this method returns, contains a MembershipCreateStatus enumeration value that indicates whether the user account was created successfully. This parameter is passed uninitiated.

Return Value

Type: System.Web.Security.MembershipUser
A MembershipUser object that is populated with the information for the newly created user account.

If a MembershipValidatePasswordEventHandler event handler has been specified, the CreateUser(String, String, String, String, String, Boolean, Object, MembershipCreateStatus) method raises the ValidatingPassword() event and continues or cancels the create-user action based on the results of the event. You can use the OnValidatingPassword() method to handle the MembershipValidatePasswordEventHandler event.


If the SimpleMembershipProvider class has been initialized using a call to the WebSecurity.InitializeDatabaseConnection() method, this method is not supported and will throw a NotSupportedException exception. However, if the WebSecurity.InitializeDatabaseConnection() method has not been called, and if you have configured your site to use the standard ASP.NET membership provider, this method is passed through to the standard membership provider. For more information, see the SimpleMembershipProvider class overview.

  • Medium trust for the immediate caller. This member can be used by partially trusted code.