AnonymousIdentificationModule 类
定义
管理 ASP.NET 应用程序的匿名标识符。Manages anonymous identifiers for the ASP.NET application.
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 文件。The following code example shows a Web.config file for an application that enables anonymous identification.
<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 应用程序的匿名标识符。The AnonymousIdentificationModule class creates and manages anonymous identifiers for an ASP.NET application. 匿名标识符由支持匿名标识(如 ASP.NET)的功能使用 System.Web.Profile 。Anonymous identifiers are used by features that support anonymous identification such as the ASP.NET System.Web.Profile.
AnonymousIdentificationModule公开一个 Creating 事件,使你能够将匿名标识符设置为自定义值。The AnonymousIdentificationModule exposes a Creating event that enables you to set the anonymous identifier to a custom value. 如果未指定自定义匿名标识符值, Guid 则使用。If you do not specify a custom anonymous identifier value, a Guid is used.
Creating可以通过在 ASP.NET 应用程序的 global.asax 文件中指定名为 AnonymousIdentification_Creating 的子程序来访问事件。The Creating event is accessed by specifying a subroutine named AnonymousIdentification_Creating in the Global.asax file for your ASP.NET application.
AnonymousIdentificationModule仅当匿名身份验证 Enabled 通过将anonymousIdentification配置元素的 enabled 属性设置为时,才使用 true 。The AnonymousIdentificationModule is only used when anonymous identification is Enabled by setting the enabled attribute of the anonymousIdentification configuration element to true.
备注
匿名标识独立于任何类型的 ASP.NET authentication。Anonymous identification is independent of any type of ASP.NET authentication.
构造函数
| AnonymousIdentificationModule() |
创建 AnonymousIdentificationModule 类的实例。Creates an instance of the AnonymousIdentificationModule class. |
属性
| Enabled |
获取用来指示该 ASP.NET 应用程序是否启用匿名标识的值。Gets a value indicating whether anonymous identification is enabled for the ASP.NET application. |
方法
| ClearAnonymousIdentifier() |
清除与某个会话关联的匿名 Cookie 或标识符。Clears the anonymous cookie or identifier associated with a session. |
| Dispose() |
释放 AnonymousIdentificationModule 使用的所有资源,内存除外。Releases all resources, other than memory, used by the AnonymousIdentificationModule. |
| Equals(Object) |
确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object. (继承自 Object) |
| GetHashCode() |
作为默认哈希函数。Serves as the default hash function. (继承自 Object) |
| GetType() |
获取当前实例的 Type。Gets the Type of the current instance. (继承自 Object) |
| Init(HttpApplication) |
初始化 AnonymousIdentificationModule 对象。Initializes the AnonymousIdentificationModule object. |
| MemberwiseClone() |
创建当前 Object 的浅表副本。Creates a shallow copy of the current Object. (继承自 Object) |
| ToString() |
返回表示当前对象的字符串。Returns a string that represents the current object. (继承自 Object) |
事件
| Creating |
创建新的匿名标识符时出现。Occurs when a new anonymous identifier is created. |