Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

AnonymousIdentificationModule Class

Manages anonymous identifiers for the ASP.NET application.

System.Object
  System.Web.Security.AnonymousIdentificationModule

Namespace:  System.Web.Security
Assembly:  System.Web (in System.Web.dll)

public sealed class AnonymousIdentificationModule : IHttpModule

The AnonymousIdentificationModule type exposes the following members.

  NameDescription
Public methodAnonymousIdentificationModuleCreates an instance of the AnonymousIdentificationModule class.
Top

  NameDescription
Public propertyStatic memberEnabledGets a value indicating whether anonymous identification is enabled for the ASP.NET application.
Top

  NameDescription
Public methodStatic memberClearAnonymousIdentifierClears the anonymous cookie or identifier associated with a session.
Public methodDisposeReleases all resources, other than memory, used by the AnonymousIdentificationModule.
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodInitInitializes the AnonymousIdentificationModule object.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

  NameDescription
Public eventCreatingOccurs when a new anonymous identifier is created.
Top

The AnonymousIdentificationModule class creates and manages anonymous identifiers for an ASP.NET application. Anonymous identifiers are used by features that support anonymous identification such as the ASP.NET System.Web.Profile.

The AnonymousIdentificationModule exposes a Creating event that enables you to set the anonymous identifier to a custom value. If you do not specify a custom anonymous identifier value, a Guid is used.

The Creating event is accessed by specifying a subroutine named AnonymousIdentification_Creating in the Global.asax file for your ASP.NET application.

The AnonymousIdentificationModule is only used when anonymous identification is Enabled by setting the enabled attribute of the anonymousIdentification configuration element to true.

NoteNote

Anonymous identification is independent of any type of ASP.NET authentication.

The following code example shows a Web.config file for an application that enables anonymous identification.

<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>

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2015 Microsoft