Share via


ValidatingPropertiesEventArgs.Properties Proprietà

Definizione

Ottiene l'insieme dei nomi e dei valori delle proprietà del profilo da convalidare.

public:
 property System::Collections::Generic::IDictionary<System::String ^, System::Object ^> ^ Properties { System::Collections::Generic::IDictionary<System::String ^, System::Object ^> ^ get(); };
public System.Collections.Generic.IDictionary<string,object> Properties { get; }
member this.Properties : System.Collections.Generic.IDictionary<string, obj>
Public ReadOnly Property Properties As IDictionary(Of String, Object)

Valore della proprietà

Nomi e valori delle proprietà del profilo da convalidare.

Esempio

Nell'esempio seguente viene illustrato un gestore eventi per l'evento ValidatingProperties . Quando il valore passato per FirstName la proprietà è vuoto o null, la FirstName proprietà viene aggiunta all'insieme FailedProperties .

void Application_Start(object sender, EventArgs e) 
{
    System.Web.ApplicationServices.ProfileService.ValidatingProperties += new EventHandler<System.Web.ApplicationServices.ValidatingPropertiesEventArgs>(ProfileService_ValidatingProperties);
}

void ProfileService_ValidatingProperties(object sender, System.Web.ApplicationServices.ValidatingPropertiesEventArgs e)
{
    if (String.IsNullOrEmpty((string)e.Properties["FirstName"]))
    {
        e.FailedProperties.Add("FirstName");
    }
}
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
    AddHandler System.Web.ApplicationServices.ProfileService.ValidatingProperties, _
      AddressOf ProfileService_ValidatingProperties
End Sub

Sub ProfileService_ValidatingProperties(ByVal sender As Object, ByVal e As System.Web.ApplicationServices.ValidatingPropertiesEventArgs)
    If (String.IsNullOrEmpty(CType(e.Properties("FirstName"), String))) Then
        e.FailedProperties.Add("FirstName")
    End If
End Sub

Commenti

La Properties proprietà restituisce un IDictionary oggetto che contiene i nomi e i valori delle proprietà del profilo da impostare per l'utente. Se si crea un gestore eventi per l'evento ValidatingProperties , è possibile recuperare le proprietà da convalidare dalla Properties proprietà . Se la convalida dei valori non riesce, aggiungerli alla FailedProperties proprietà . Il SetPropertiesForCurrentUser metodo restituisce l'insieme nella FailedProperties proprietà in modo che sia possibile determinare quali proprietà non sono state convalidate.

Si applica a