Επεξεργασία

Κοινή χρήση μέσω


MembershipProvider.CreateUser Method

Definition

Adds a new membership user to the data source.

public:
 abstract System::Web::Security::MembershipUser ^ CreateUser(System::String ^ username, System::String ^ password, System::String ^ email, System::String ^ passwordQuestion, System::String ^ passwordAnswer, bool isApproved, System::Object ^ providerUserKey, [Runtime::InteropServices::Out] System::Web::Security::MembershipCreateStatus % status);
public abstract System.Web.Security.MembershipUser CreateUser (string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out System.Web.Security.MembershipCreateStatus status);
abstract member CreateUser : string * string * string * string * string * bool * obj * MembershipCreateStatus -> System.Web.Security.MembershipUser
Public MustOverride Function CreateUser (username As String, password As String, email As String, passwordQuestion As String, passwordAnswer As String, isApproved As Boolean, providerUserKey As Object, ByRef status As MembershipCreateStatus) As MembershipUser

Parameters

username
String

The user name for the new user.

password
String

The password for the new user.

email
String

The email address for the new user.

passwordQuestion
String

The password question for the new user.

passwordAnswer
String

The password answer for the new user.

isApproved
Boolean

Whether or not the new user is approved to be validated.

providerUserKey
Object

The unique identifier from the membership data source for the user.

status
MembershipCreateStatus

A MembershipCreateStatus enumeration value indicating whether the user was created successfully.

Returns

A MembershipUser object populated with the information for the newly created user.

Examples

For an example of a MembershipProvider implementation, see Implementing a Profile Provider.

Remarks

Takes, as input, the name of a new user, a password, and an email address and inserts a new user for the application into the data source. The CreateUser method returns a MembershipUser object populated with the information for the newly created user. The CreateUser method also defines an out parameter (in Visual Basic, you can use ByRef) that returns a MembershipCreateStatus value that indicates that the user was successfully created, or a reason that user creation failed.

The CreateUser method raises the ValidatingPassword event, if a MembershipValidatePasswordEventHandler event handler has been specified, and continues or cancels the create-user action based on the results of the event. You can use the OnValidatingPassword virtual method to execute the specified MembershipValidatePasswordEventHandler event handler.

Applies to

See also