AnonymousIdentificationModule 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
管理 ASP.NET 应用程序的匿名标识符。
public ref class AnonymousIdentificationModule sealed : System::Web::IHttpModule
public sealed class AnonymousIdentificationModule : System.Web.IHttpModule
type AnonymousIdentificationModule = class
interface IHttpModule
Public NotInheritable Class AnonymousIdentificationModule
Implements IHttpModule
- 继承
-
AnonymousIdentificationModule
- 实现
示例
下面的代码示例演示了一个启用匿名标识的应用程序的 Web.config 文件。
<configuration>
<system.web>
<authentication mode="Forms" >
<forms loginUrl="login.aspx" name=".ASPXFORMSAUTH" />
</authentication>
<anonymousIdentification enabled="true" />
<profile 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>
注解
AnonymousIdentificationModule 类为 ASP.NET 应用程序创建和管理匿名标识符。 匿名标识符由支持匿名标识的功能(如 ASP.NET System.Web.Profile)使用。
公开 AnonymousIdentificationModule 一个 Creating 事件,使你能够将匿名标识符设置为自定义值。 如果未指定自定义匿名标识符值,则使用 a Guid 。
通过在 ASP.NET 应用程序的 Global.asax 文件中指定名为
AnonymousIdentificationModule仅当匿名标识Enabled是通过将 anonymousIdentification 配置元素的已启用属性设置为 true。
注释
匿名标识独立于任何类型的 ASP.NET 身份验证。
构造函数
| 名称 | 说明 |
|---|---|
| AnonymousIdentificationModule() |
创建 AnonymousIdentificationModule 类的实例。 |
属性
| 名称 | 说明 |
|---|---|
| Enabled |
获取一个值,该值指示是否为 ASP.NET 应用程序启用匿名标识。 |
方法
| 名称 | 说明 |
|---|---|
| ClearAnonymousIdentifier() |
清除与会话关联的匿名 Cookie 或标识符。 |
| Dispose() |
释放除内存以外的所有资源,供该 AnonymousIdentificationModule资源使用。 |
| Equals(Object) |
确定指定的对象是否等于当前对象。 (继承自 Object) |
| GetHashCode() |
用作默认哈希函数。 (继承自 Object) |
| GetType() |
获取当前实例的 Type。 (继承自 Object) |
| Init(HttpApplication) |
初始化 AnonymousIdentificationModule 对象。 |
| MemberwiseClone() |
创建当前 Object的浅表副本。 (继承自 Object) |
| ToString() |
返回一个表示当前对象的字符串。 (继承自 Object) |
活动
| 名称 | 说明 |
|---|---|
| Creating |
创建新的匿名标识符时发生。 |