MembershipProvider.CreateUser(String, String, String, String, String, Boolean, Object, MembershipCreateStatus) 方法

定义

将新的成员资格用户添加到数据源。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

参数

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

一个 MembershipCreateStatus 枚举值,指示是否已成功创建用户。A MembershipCreateStatus enumeration value indicating whether the user was created successfully.

返回

一个用新创建的用户的信息填充的 MembershipUser 对象。A MembershipUser object populated with the information for the newly created user.

示例

有关MembershipProvider实现的示例,请参阅实现配置文件提供程序For an example of a MembershipProvider implementation, see Implementing a Profile Provider.

注解

采用新用户的名称、密码和电子邮件地址作为输入,并将应用程序的新用户插入到数据源中。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. 方法返回用新创建的用户的信息填充的对象。MembershipUser CreateUserThe CreateUser method returns a MembershipUser object populated with the information for the newly created user. 方法还定义了一个out参数(在 Visual Basic 中,你可以ByRef使用),该MembershipCreateStatus参数将返回一个值,该值指示已成功创建用户,或是用户创建失败的原因。 CreateUserThe 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.

如果CreateUser ValidatingPassword 已指定事件处理程序,则方法将引发事件,并根据事件的结果继续或取消MembershipValidatePasswordEventHandler创建用户操作。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. 您可以使用OnValidatingPassword虚拟方法执行指定MembershipValidatePasswordEventHandler的事件处理程序。You can use the OnValidatingPassword virtual method to execute the specified MembershipValidatePasswordEventHandler event handler.

适用于

另请参阅