MembershipProvider.CreateUser Metodo

Definizione

Aggiunge un nuovo utente di appartenenza all'origine dati.

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

Parametri

username
String

Nome utente per il nuovo utente.

password
String

Password per il nuovo utente.

email
String

Indirizzo di posta elettronica del nuovo utente.

passwordQuestion
String

Domanda segreta per il nuovo utente.

passwordAnswer
String

Risposta per la password del nuovo utente.

isApproved
Boolean

Indica se il nuovo utente è o meno approvato per la convalida.

providerUserKey
Object

Identificatore univoco dall'origine dati di appartenenza per l'utente.

status
MembershipCreateStatus

Valore di enumerazione MembershipCreateStatus che indica se l'utente è stato creato.

Restituisce

Oggetto MembershipUser popolato con le informazioni per il nuovo utente creato.

Esempio

Per un MembershipProvider esempio di implementazione, vedere Implementazione di un provider di profili.

Commenti

Accetta, come input, il nome di un nuovo utente, una password e un indirizzo di posta elettronica e inserisce un nuovo utente per l'applicazione nell'origine dati. Il CreateUser metodo restituisce un MembershipUser oggetto popolato con le informazioni per l'utente appena creato. Il CreateUser metodo definisce anche un parametro (in Visual Basic, è possibile usare ByRef) che restituisce un outMembershipCreateStatus valore che indica che l'utente è stato creato correttamente o un motivo per cui la creazione dell'utente non è riuscita.

Il CreateUser metodo genera l'evento ValidatingPassword , se è stato specificato un MembershipValidatePasswordEventHandler gestore eventi e continua o annulla l'azione create-user in base ai risultati dell'evento. È possibile usare il metodo virtuale per eseguire il OnValidatingPassword gestore eventi specificato MembershipValidatePasswordEventHandler .

Si applica a

Vedi anche