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

一个 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. CreateUser方法返回 MembershipUser 用新创建的用户的信息填充的对象。The CreateUser method returns a MembershipUser object populated with the information for the newly created user. CreateUser方法还 out 在 Visual Basic 中定义了参数 (,你可以使用 ByRef) 来返回一个 MembershipCreateStatus 值,该值指示已成功创建用户,或用户创建失败的原因。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.

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.

适用于