ValidatingPropertiesEventArgs 類別

定義

提供 ValidatingProperties 事件的資料。

public ref class ValidatingPropertiesEventArgs : EventArgs
public class ValidatingPropertiesEventArgs : EventArgs
type ValidatingPropertiesEventArgs = class
    inherit EventArgs
Public Class ValidatingPropertiesEventArgs
Inherits EventArgs
繼承
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 使用者設定配置檔案屬性時,就會引發事件。 如果有任何屬性值驗證失敗,請將這些值新增至 屬性中的 FailedProperties 集合。 方法會 SetPropertiesForCurrentUser 傳回 屬性中的 FailedProperties 集合,讓您可以判斷哪些屬性驗證失敗。

屬性

FailedProperties

取得集合,包含驗證失敗的設定檔屬性。

Properties

取得要驗證的設定檔屬性名稱和值的集合。

方法

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

適用於