AnonymousIdentificationModule 類別

定義

管理 ASP.NET 應用程式的匿名識別碼。

public ref class AnonymousIdentificationModule sealed : System::Web::IHttpModule
public sealed class AnonymousIdentificationModule : System.Web.IHttpModule
type AnonymousIdentificationModule = class
    interface IHttpModule
Public NotInheritable Class AnonymousIdentificationModule
Implements IHttpModule
繼承
AnonymousIdentificationModule
實作

範例

以下程式碼範例展示了一個用於啟用匿名識別的應用程式的 Web.config 檔案。

<configuration>
  <system.web>
    <authentication mode="Forms" >
      <forms loginUrl="login.aspx" name=".ASPXFORMSAUTH" />
    </authentication>

    <anonymousIdentification enabled="true" />

    <profile defaultProvider="AspNetSqlProvider">
      <properties>
        <add name="ZipCode" allowAnonymous="true" />
        <add name="CityAndState" allowAnonymous="true" />
        <add name="StockSymbols" type="System.Collections.ArrayList"
          allowAnonymous="true" />
      </properties>
    </profile>
  </system.web>
</configuration>

備註

AnonymousIdentificationModule 類別負責為 ASP.NET 應用程式建立並管理匿名識別碼。 匿名識別碼用於支援匿名識別的功能,如 ASP.NET System.Web.Profile

AnonymousIdentificationModule 會暴露一個 Creating 事件,讓你可以將匿名識別符設定為自訂值。 若未指定自訂匿名識別碼值,則使用 a Guid

Creating 事件可透過在 Global.asax 檔案中指定名為 AnonymousIdentification_Creating 的子程式來存取,適用於您的 ASP.NET 應用程式。

AnonymousIdentificationModule僅在匿名識別Enabled時使用,方法是將匿名識別配置元素的啟用屬性設為 true

Note

匿名識別獨立於任何類型的 ASP.NET 認證。

建構函式

名稱 Description
AnonymousIdentificationModule()

建立 AnonymousIdentificationModule 類別的執行個體。

屬性

名稱 Description
Enabled

會獲得一個值,指示 ASP.NET 應用程式是否啟用匿名識別。

方法

名稱 Description
ClearAnonymousIdentifier()

清除與會話相關的匿名 cookie 或識別碼。

Dispose()

釋放除記憶體外的所有資源 AnonymousIdentificationModule

Equals(Object)

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

(繼承來源 Object)
GetHashCode()

做為預設哈希函式。

(繼承來源 Object)
GetType()

取得目前實例的 Type

(繼承來源 Object)
Init(HttpApplication)

初始化 AnonymousIdentificationModule 物件。

MemberwiseClone()

建立目前 Object的淺層複本。

(繼承來源 Object)
ToString()

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

(繼承來源 Object)

事件

名稱 Description
Creating

當建立新的匿名識別碼時會發生。

適用於