程序开发里面的profile

Profile是针对每个帐户的数据存储,比如一个电子商务网站的用户购物车数据。
“用户配置文件”是Profile这个词的直接翻译,其实没有文件的意思,默认存储在数据库中,不用自己管理文件。
Profile是HttpContext类的一个属性,是ProfileBase类,继承自SettingsBase类。
所谓Provider,是你可以定义Profile如何存储,默认是存储在LocalServer数据库中,需要网站重启动不丢失数据,所以不能存在内存中。
web.config中必须的Profile属性:什么叫必须?你如果不修改默认存储,只有每个Profile的name是必须的,如:
<profile defaultProvider="SqlProvider">//修改存储才需要
<providers>
<clear />
<add name="SqlProvider"
type="System.Web.Profile.SqlProfileProvider"
connectionStringName="SqlServices"
applicationName="SampleApplication"
description="SqlProfileProvider for SampleApplication" />
</providers>

<properties>
<add name="ZipCode" />//用户配置的项目才是必须的
<add name="CityAndState" />
</properties>
</profile>
</system.web>
posted @ 2009-12-01 14:06  Joe_true  阅读(260)  评论(0编辑  收藏  举报