다음을 통해 공유


ProfileService.ValidatingProperties 이벤트

정의

사용자의 프로필 속성이 설정될 때 발생합니다.

public:
 static event EventHandler<System::Web::ApplicationServices::ValidatingPropertiesEventArgs ^> ^ ValidatingProperties;
public static event EventHandler<System.Web.ApplicationServices.ValidatingPropertiesEventArgs> ValidatingProperties;
member this.ValidatingProperties : EventHandler<System.Web.ApplicationServices.ValidatingPropertiesEventArgs> 
Public Shared Custom Event ValidatingProperties As EventHandler(Of ValidatingPropertiesEventArgs) 

이벤트 유형

예제

다음 예제에서는 이벤트 처리기는 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

설명

에 대 한 이벤트 처리기를 만들 수 있습니다는 ValidatingProperties 이벤트 속성 값의 유효성을 검사 하거나 해당 값을 동적으로 변경 합니다. ValidatingProperties 이벤트는 때를 SetPropertiesForCurrentUser 메서드가 호출 됩니다. 값 속성 유효성 검사 실패에 대 한 해당 속성을 추가 하는 경우는 FailedProperties 의 컬렉션을 ValidatingPropertiesEventArgs 클래스입니다. 에 있는 모든 속성은 FailedProperties 컬렉션 사용자 프로필에 저장 되지 것입니다.

추가 하 고 Global.asax 파일에 이벤트 처리기를 등록할 수 있습니다.

적용 대상