AnonymousIdentificationEventArgs 类
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
提供 AnonymousIdentification_Creating 事件的数据。 此类不能被继承。
public ref class AnonymousIdentificationEventArgs sealed : EventArgs
public sealed class AnonymousIdentificationEventArgs : EventArgs
type AnonymousIdentificationEventArgs = class
inherit EventArgs
Public NotInheritable Class AnonymousIdentificationEventArgs
Inherits EventArgs
- 继承
下面的代码示例使用 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
类 AnonymousIdentificationEventArgs 用于向事件提供事件值 Creating ,并使你能够为当前请求指定自定义 Windows 标识。 可以通过在 Creating Global.asax 文件中为 ASP.NET 应用程序指定名为 AnonymousIdentification_Creating 的子例程来访问 类的事件AnonymousIdentificationModule。
使用AnonymousIdentificationModule当前 HttpContext 构造AnonymousIdentificationEventArgs对象,并将其传递给 AnonymousIdentification_Creating 事件。
可以使用AnonymousID提供给 AnonymousIdentification_Creating 事件的 对象的 属性AnonymousIdentificationEventArgs将匿名标识符设置为自定义值。 如果在 AnonymousIdentification_Creating 事件期间未为 AnonymousID 属性指定值,Guid则使用 。
仅当匿名标识为 Enabled时,才会引发 AnonymousIdentification_Creating 事件。
AnonymousID |
获取或设置用户的匿名标识符。 |
Context |
为当前 HTTP 请求获取 HttpContext 对象。 |
Equals(Object) |
确定指定对象是否等于当前对象。 (继承自 Object) |
Get |
作为默认哈希函数。 (继承自 Object) |
Get |
获取当前实例的 Type。 (继承自 Object) |
Memberwise |
创建当前 Object 的浅表副本。 (继承自 Object) |
To |
返回表示当前对象的字符串。 (继承自 Object) |
产品 | 版本 |
---|---|
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |