Share via


ValidatingPropertiesEventArgs.Properties Propriedade

Definição

Obtém a coleção de nomes e de valores das propriedades de perfil a serem validadas.

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)

Valor da propriedade

Os nomes e valores das propriedades de perfil a serem validadas.

Exemplos

O exemplo a seguir mostra um manipulador de eventos para o ValidatingProperties evento. Quando o valor passado para FirstName a propriedade está vazio ou null, a FirstName propriedade é adicionada à FailedProperties coleção.

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

Comentários

A Properties propriedade retorna um IDictionary objeto que contém os nomes e valores das propriedades de perfil a serem definidas para o usuário. Se você criar um manipulador de eventos para o ValidatingProperties evento, poderá recuperar as propriedades a serem validadas da Properties propriedade . Se algum valor falhar na validação, adicione-os à FailedProperties propriedade . O SetPropertiesForCurrentUser método retorna a coleção na propriedade para que você possa determinar quais propriedades falharam na FailedProperties validação.

Aplica-se a