ProfileBase.Create Metodo
Definizione
Crea un'istanza di un profilo utente.Creates an instance of a user profile.
Overload
Create(String) |
Viene utilizzato da ASP.NET per creare un'istanza di un profilo per il nome utente specificato.Used by ASP.NET to create an instance of a profile for the specified user name. |
Create(String, Boolean) |
Viene utilizzato da ASP.NET per creare un'istanza di un profilo per il nome utente specificato.Used by ASP.NET to create an instance of a profile for the specified user name. Questo metodo accetta un parametro che indica se l'utente è autenticato o anonimo.Takes a parameter indicating whether the user is authenticated or anonymous. |
Create(String)
Viene utilizzato da ASP.NET per creare un'istanza di un profilo per il nome utente specificato.Used by ASP.NET to create an instance of a profile for the specified user name.
public:
static System::Web::Profile::ProfileBase ^ Create(System::String ^ username);
public static System.Web.Profile.ProfileBase Create (string username);
static member Create : string -> System.Web.Profile.ProfileBase
Public Shared Function Create (username As String) As ProfileBase
Parametri
- username
- String
Nome dell'utente per cui creare il profilo.The name of the user to create a profile for.
Restituisce
Un oggetto ProfileBase che rappresenta il profilo per l'utente specificato.An ProfileBase that represents the profile for the specified user.
Eccezioni
L'attributo enabled
della sezione profile del file Web.config è false
.The enabled
attribute of the profile section of the Web.config file is false
.
Il livello di autorizzazione host corrente è inferiore a Medium.The current hosting permission level is less than Medium.
Non è stato possibile creare un tipo di proprietà specificato nella sezione profile del file Web.config.A property type specified in the profile section of the Web.config file could not be created.
-oppure--or-
L'attributo allowAnonymous
di una proprietà nella sezione profile del file Web.config è impostato su true
e l'attributo enabled
dell'elemento <anonymousIdentification> è impostato su false
.The allowAnonymous
attribute for a property in the profile section of the Web.config file is set to true
and the enabled
attribute of the <anonymousIdentification> element is set to false
.
-oppure--or-
L'attributo serializeAs
di una proprietà nella sezione profile del file Web.config è impostato su Binary e la proprietà IsSerializable di type
specificato restituisce false
.The serializeAs
attribute for a property in the profile section of the Web.config file is set to Binary and the IsSerializable property of the specified type
returns false
.
-oppure--or-
Non è stato possibile trovare il nome di un provider specificato mediante l'attributo provider
di una proprietà del profilo nell'insieme Providers.The name of a provider specified using the provider
attribute of a profile property could not be found in the Providers collection.
-oppure--or-
Non è stato possibile trovare il type
specificato per una proprietà del profilo.The type
specified for a profile property could not be found.
-oppure--or-
Una proprietà del profilo è stata specificata con un nome corrispondente a una proprietà nella classe base specificata nell'attributo inherits
della sezione profile.A profile property was specified with a name that matches a property name on the base class specified in the inherits
attribute of the profile section.
Esempio
Nell'esempio di codice seguente viene creata un'istanza di un oggetto profilo personalizzato, viene impostata una proprietà e il profilo viene salvato nell'origine dati.The following code example creates an instance of a custom profile object, sets a property, and saves the profile to the data source.
MyCustomProfile myProfile = (MyCustomProfile)ProfileBase.Create("username");
myProfile.ZipCode = "98052";
myProfile.Save();
Dim myProfile As MyCustomProfile = CType(ProfileBase.Create("username"), MyCustomProfile)
myProfile.ZipCode = "98052"
myProfile.Save()
Commenti
Il Create metodo crea e Inizializza una nuova istanza del profilo ed è utile per le applicazioni che usano un oggetto profilo personalizzato o gestiscono profili utente in un ambiente non-ASP.NET.The Create method creates and initializes a new profile instance and is useful for applications that use a custom profile object or manage user profiles in a non-ASP.NET environment.
Questo overload del Create metodo presuppone che il nome utente specificato sia un utente autenticato.This overload of the Create method assumes that the specified user name is an authenticated user.
Vedi anche
Si applica a
Create(String, Boolean)
Viene utilizzato da ASP.NET per creare un'istanza di un profilo per il nome utente specificato.Used by ASP.NET to create an instance of a profile for the specified user name. Questo metodo accetta un parametro che indica se l'utente è autenticato o anonimo.Takes a parameter indicating whether the user is authenticated or anonymous.
public:
static System::Web::Profile::ProfileBase ^ Create(System::String ^ username, bool isAuthenticated);
public static System.Web.Profile.ProfileBase Create (string username, bool isAuthenticated);
static member Create : string * bool -> System.Web.Profile.ProfileBase
Public Shared Function Create (username As String, isAuthenticated As Boolean) As ProfileBase
Parametri
- username
- String
Nome dell'utente per cui creare il profilo.The name of the user to create a profile for.
- isAuthenticated
- Boolean
true
per indicare che l'utente è autenticato, false
per indicare che l'utente è anonimo.true
to indicate the user is authenticated; false
to indicate the user is anonymous.
Restituisce
Un oggetto ProfileBase che rappresenta il profilo per l'utente specificato.A ProfileBase object that represents the profile for the specified user.
Eccezioni
L'attributo enabled
della sezione profile del file Web.config è false
.The enabled
attribute of the profile section of the Web.config file is false
.
Il livello di autorizzazione host corrente è inferiore a Medium.The current hosting permission level is less than Medium.
Non è stato possibile creare un tipo di proprietà specificato nella sezione profile del file Web.config.A property type specified in the profile section of the Web.config file could not be created.
-oppure--or-
L'attributo allowAnonymous
di una proprietà nella sezione profile del file Web.config è impostato su true
e l'attributo enabled
dell'elemento <anonymousIdentification> è impostato su false
.The allowAnonymous
attribute for a property in the profile section of the Web.config file is set to true
and the enabled
attribute of the <anonymousIdentification> element is set to false
.
-oppure--or-
L'attributo serializeAs
di una proprietà nella sezione profile del file Web.config è impostato su Binary e la proprietà IsSerializable di type
specificato restituisce false
.The serializeAs
attribute for a property in the profile section of the Web.config file is set to Binary and the IsSerializable property of the specified type
returns false
.
-oppure--or-
Non è stato possibile trovare il nome di un provider specificato mediante l'attributo provider
di una proprietà del profilo nell'insieme Providers.The name of a provider specified using the provider
attribute of a profile property could not be found in the Providers collection.
-oppure--or-
Non è stato possibile trovare il type
specificato per una proprietà del profilo.The type
specified for a profile property could not be found.
-oppure--or-
Una proprietà del profilo è stata specificata con un nome corrispondente a una proprietà nella classe base specificata nell'attributo inherits
della sezione profile.A profile property was specified with a name that matches a property name on the base class specified in the inherits
attribute of the profile section.
Esempio
Nell'esempio di codice seguente viene creata un'istanza di un oggetto profilo personalizzato, viene impostata una proprietà e il profilo viene salvato nell'origine dati.The following code example creates an instance of a custom profile object, sets a property, and saves the profile to the data source.
MyCustomProfile profile = (MyCustomProfile)ProfileBase.Create("username", true);
profile.ZipCode = "98052";
profile.Save();
Dim profile As MyCustomProfile = CType(ProfileBase.Create("username", True), MyCustomProfile)
profile.ZipCode = "98052"
profile.Save()
Commenti
Il Create metodo crea e Inizializza una nuova istanza del profilo ed è utile per le applicazioni che usano un oggetto profilo personalizzato o gestiscono profili utente in un ambiente non-ASP.NET.The Create method creates and initializes a new profile instance and is useful for applications that use a custom profile object or manage user profiles in a non-ASP.NET environment.
Questo overload del Create metodo può essere utilizzato per creare un profilo per un utente autenticato o un utente anonimo.This overload of the Create method can be used to create a profile for an authenticated user or an anonymous user.