Export (0) Print
Expand All
1 out of 3 rated this helpful - Rate this topic

HttpRequest.AnonymousID Property

Updated: December 2009

Gets the anonymous identifier for the user, if present.

Namespace:  System.Web
Assembly:  System.Web (in System.Web.dll)
public function get AnonymousID () : String

Property Value

Type: System.String
A string representing the current anonymous user identifier.

The AnonymousId property assigns a long-lived unique identifier to a non-authenticated user, which can be used to track the user or assign profile properties to that user without storing data in a Session object. By default, the AnonymousId property is tracked using a cookie, but it can be set to use the URI when the Cookieless attribute in the anonymous identification configuration section is set to either the UseUri, UseDeviceProfile, or AutoDetect value. You must explicitly clear the cookie if you no longer want it available, for example when an anonymous user is authenticated.

Anonymous identification is used when there is a need to identify entities that are not authenticated and when authorization is required. For more information, see anonymousIdentification Element (ASP.NET Settings Schema)

The following example shows how to use the AnonymousId property by handling the AnonymousIdentificationModule.Creating event in the Global.asax file. This example has two parts:

The first part of the code example shows how to set the AnonymousId property by handling the AnonymousIdentificationModule.Creating event in the Global.asax file. The method that is named AnonymousIdentification_Creating sets the AnonymousId property when an anonymous ID is created.

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

The second part of the code example shows how to display the new AnonymousId that is created by the AnonymousIdentification_Creating event handler in the preceding example.

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

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

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

.NET Framework

Supported in: 3.5, 3.0, 2.0

Date

History

Reason

December 2009

Rewrote the example to make it clearer.

Customer feedback.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.