Export (0) Print
Expand All

SimpleMembershipProvider.CreateUser Method

Adds the specified user to the membership database.

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

'Declaration
Public Overrides Function CreateUser ( _
	username As String, _
	password As String, _
	email As String, _
	passwordQuestion As String, _
	passwordAnswer As String, _
	isApproved As Boolean, _
	providerUserKey As Object, _
	<OutAttribute> ByRef status As MembershipCreateStatus _
) As MembershipUser
'Usage
Dim instance As SimpleMembershipProvider
Dim username As String
Dim password As String
Dim email As String
Dim passwordQuestion As String
Dim passwordAnswer As String
Dim isApproved As Boolean
Dim providerUserKey As Object
Dim status As MembershipCreateStatus
Dim returnValue As MembershipUser

returnValue = instance.CreateUser(username, _
	password, email, passwordQuestion, _
	passwordAnswer, isApproved, providerUserKey, _
	status)

Parameters

username
Type: System.String
The user name for the new user account.
password
Type: System.String
The password for the new user account.
email
Type: System.String
The email address for the new user account.
passwordQuestion
Type: System.String
The security question for the new user account.
passwordAnswer
Type: System.String
The answer to the security question for the new user account.
isApproved
Type: System.Boolean
true to indicate that the user account is approved to be validated; otherwise, false.
providerUserKey
Type: System.Object
The unique identifier from the membership data source for the user account.
status
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.

NoteNote:

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.
Show:
© 2014 Microsoft