ValidatingPropertiesEventArgs.Properties Propriedade

Definição

Obtém a coleção de nomes e de valores das propriedades de perfil a serem validadas.Gets the collection of names and values of the profile properties to validate.

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

IDictionary<String,Object>

Os nomes e valores das propriedades de perfil a serem validadas.The names and values of the profile properties to validate.

Exemplos

O exemplo a seguir mostra um manipulador de eventos para o ValidatingProperties evento.The following example shows an event handler for the ValidatingProperties event. Quando o valor passado para a FirstName propriedade está vazio ou null , a FirstName propriedade é adicionada à FailedProperties coleção.When the value passed for FirstName property is empty or null, the FirstName property is added to the FailedProperties collection.

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.The Properties property returns an IDictionary object that contains the names and values of the profile properties to set for the user. Se você criar um manipulador de eventos para o ValidatingProperties evento, poderá recuperar as propriedades para validar a partir da Properties propriedade.If you create an event handler for the ValidatingProperties event, you can retrieve the properties to validate from the Properties property. Se qualquer valor falhar na validação, adicione-os à FailedProperties propriedade.If any values fail validation, add them to the FailedProperties property. O SetPropertiesForCurrentUser método retorna a coleção na FailedProperties propriedade para que você possa determinar quais propriedades falharam na validação.The SetPropertiesForCurrentUser method returns the collection in the FailedProperties property so that you can determine which properties failed validation.

Aplica-se a