AnonymousIdentificationEventArgs 類別

定義

提供 AnonymousIdentification_Creating 事件的資料。 此類別無法獲得繼承。

public ref class AnonymousIdentificationEventArgs sealed : EventArgs
public sealed class AnonymousIdentificationEventArgs : EventArgs
type AnonymousIdentificationEventArgs = class
    inherit EventArgs
Public NotInheritable Class AnonymousIdentificationEventArgs
Inherits EventArgs
繼承
AnonymousIdentificationEventArgs

範例

下列程式碼範例會使用 AnonymousIdentification_Creating 事件,將匿名識別碼設定為自訂值。

public void AnonymousIdentification_Creating(object sender, 
                                             AnonymousIdentificationEventArgs args)
{
  args.AnonymousID = Samples.AspNet.Security.MyIdClass.GetAnonymousId();
  Samples.AspNet.Security.MyIdClass.LogAnonymousId(args.AnonymousID);
}
Public Sub AnonymousIdentification_Creating(sender As Object,  _
                                            args As AnonymousIdentificationEventArgs)
  args.AnonymousID = Samples.AspNet.Security.MyIdClass.GetAnonymousId()
  Samples.AspNet.Security.MyIdClass.LogAnonymousId(args.AnonymousId)
End Sub

備註

類別 AnonymousIdentificationEventArgs 可用來提供事件值給 Creating 事件,並可讓您指定目前要求的自訂 Windows 身分識別。 您可以在 ASP.NET 應用程式的 Global.asax 檔案中指定名為AnonymousIdentification_Creating的副程式,以存取 CreatingAnonymousIdentificationModule 類別的事件。

AnonymousIdentificationModule 使用目前的 HttpContext 建構 AnonymousIdentificationEventArgs 物件,並將它傳遞至AnonymousIdentification_Creating事件。

您可以使用 AnonymousID 提供給AnonymousIdentification_Creating事件的 物件屬性 AnonymousIdentificationEventArgs ,將匿名識別碼設定為自訂值。 如果您在AnonymousIdentification_Creating事件期間未指定 屬性的值 AnonymousIDGuid 則會使用 。

只有在匿名識別為 Enabled 時,才會引發AnonymousIdentification_Creating事件。

建構函式

AnonymousIdentificationEventArgs(HttpContext)

初始化 AnonymousIdentificationEventArgs 類別的新執行個體。

屬性

AnonymousID

取得或設定使用者的匿名識別項。

Context

取得目前 HTTP 要求的 HttpContext 物件。

方法

Equals(Object)

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

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

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

(繼承來源 Object)

適用於