程序开发里面的profile

原文链接: http://www.cnblogs.com/Joseph_net/archive/2009/12/01/1614530.html
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>

转载于:https://www.cnblogs.com/Joseph_net/archive/2009/12/01/1614530.html

猜你喜欢

转载自blog.csdn.net/weixin_30375247/article/details/94786530