ASP.NET个性化设置相关的API(转载)

来源:互联网 发布:西卡笑笑的淘宝店 编辑:程序博客网 时间:2024/05/18 02:06

System.Web.Profile

ProfileBase ,  ProfileManager类

1、ProfileBase类

ProfileBase类是用户配置功能中一个非常重要的类。该类能够提供对用户配置属性的非类型化访问。

当启用包含用户配置功能的应用程序时,asp.net将自动创建一个类型为ProfileCommon的新类,该类从ProfileBase类继承。同时系统将根据<profile>配置节内容,在ProfileCommon新类中添加强类型访问器。这样,ProfileCommon新类的强类型访问器就能调用ProfileBase基类的GetPropertyValue和SetPropertyValue方法,从而实现对用户配置属性的检索和设置。ProfileCommon对象被设置到了应用程序的Profile属性。可以通过Profile属性实现检索和设置用户配置属性信息。

<system.web><anonymousIdentification enabled="true"/>    <profile enabled="true">   <properties>    <add name="Name" type="System.String" allowAnonymous="true"/>   </properties>  </profile></system.web>


Profile属性具有以下3个特点:

1、强类型

 

2、长期存储

 

3、支持匿名用户


原创粉丝点击