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 値が空または 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

注釈

プロパティは Properties 、ユーザーに IDictionary 設定するプロファイル プロパティの名前と値を含むオブジェクトを返します。 イベントのイベント ハンドラーを作成する ValidatingProperties 場合は、 プロパティから検証するプロパティを Properties 取得できます。 値が検証に失敗した場合は、 プロパティに FailedProperties 追加します。 メソッドは SetPropertiesForCurrentUser 、検証に失敗したプロパティを FailedProperties 特定できるように、 プロパティのコレクションを返します。

適用対象