다음을 통해 공유


ValidatingPropertiesEventArgs.Properties 속성

정의

유효성을 검사할 프로필 속성에 대한 이름과 값의 컬렉션을 가져옵니다.

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)

속성 값

유효성을 검사할 프로필 속성의 이름과 값입니다.

예제

다음 예제에서는 이벤트 처리기는 ValidatingProperties 이벤트입니다. 에 대 한 값을 전달 하는 경우 FirstName 속성이 비어 또는 nullFirstName 속성을 추가 합니다 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

설명

합니다 Properties 속성이 반환을 IDictionary 이름 및 사용자에 대해 설정할 프로필 속성의 값을 포함 하는 개체입니다. 에 대 한 이벤트 처리기를 만드는 경우 합니다 ValidatingProperties 이벤트에서 유효성을 검사 하는 속성을 검색할 수 있습니다는 Properties 속성입니다. 모든 값이 유효성 검사에 실패 하는 경우 추가 하는 FailedProperties 속성입니다. SetPropertiesForCurrentUser 의 컬렉션을 반환 하는 메서드는 FailedProperties 속성 유효성 검사에 실패 한 속성을 확인할 수 있도록 합니다.

적용 대상