AnonymousIdentificationEventArgs.AnonymousID 属性

定义

获取或设置用户的匿名标识符。

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

属性值

用户的匿名标识符。

示例

下面的代码示例使用 AnonymousIdentification_Creating 事件将匿名标识符设置为自定义值。

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

注解

AnonymousIdentification_Creating 事件期间,AnonymousID可以使用 属性将匿名标识符设置为自定义值。 如果在AnonymousIdentification_Creating事件期间未指定 AnonymousID 属性的值,Guid则使用 。

仅当匿名标识为 Enabled时,才会引发 AnonymousIdentification_Creating 事件。

适用于