Export (0) Print
Expand All

ProfileMigrateEventArgs::AnonymousID Property

Gets the anonymous identifier for the anonymous profile from which to migrate profile property values.

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

public:
property String^ AnonymousID {
	String^ get ();
}

Property Value

Type: System::String
The anonymous identifier for the anonymous profile from which to migrate profile property values.

The AnonymousID property contains the unique identifier for an anonymous user. When someone who has been using your application anonymously logs in, you can handle the MigrateAnonymous event to copy profile property values from the user's anonymous profile to his or her authenticated profile.

When an application that has the user profile enabled is started, ASP.NET creates a new class of type ProfileCommon, which inherits from the ProfileBase class and includes profile properties specified in the Web.config file. When the ProfileCommon class is generated, a GetProfile method is added that enables you to retrieve a ProfileCommon object based on a user name. You can use the GetProfile method of the current profile to retrieve the property values of the anonymous profile. The anonymous property values can then be copied to the current profile for the authenticated user. See the second code example for an example of copying anonymous property values.

The following code examples show a Web.config file that enables anonymous authentication and the MigrateAnonymous event included in the Global.asax file for an ASP.NET application

The following code example shows a Web.config file that enables anonymous identification and profile properties that support anonymous users.

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

    <AnonymousIdentification enabled="true" />

    <profile enabled="true" 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>

The following code example shows the MigrateAnonymous event included in the Global.asax file for an ASP.NET application. The MigrateAnonymous event copies profile property values from the anonymous profile to the profile for the current user.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft