ProfileService.ValidatingProperties 이벤트
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
사용자의 프로필 속성이 설정될 때 발생합니다.
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
속성이 비어 또는 null
의 FirstName
속성을 추가 합니다 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 파일에 이벤트 처리기를 등록할 수 있습니다.
적용 대상
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기