แก้ไข

แชร์ผ่าน


AnonymousIdentificationEventArgs.AnonymousID Property

Definition

Gets or sets the anonymous identifier for the user.

public:
 property System::String ^ AnonymousID { System::String ^ get(); void set(System::String ^ value); };
public string AnonymousID { get; set; }
member this.AnonymousID : string with get, set
Public Property AnonymousID As String

Property Value

The anonymous identifier for the user.

Examples

The following code example uses the AnonymousIdentification_Creating event to set the anonymous identifier to a custom value.

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

Remarks

You can use the AnonymousID property to set the anonymous identifier to a custom value during the AnonymousIdentification_Creating event. If you do not specify a value for the AnonymousID property during the AnonymousIdentification_Creating event, a Guid is used.

The AnonymousIdentification_Creating event is only raised when the anonymous identification is Enabled.

Applies to