定义用户配置文件属性和属性组的集合。
此元素是 .NET Framework 2.0 版中的新元素。
<configuration> 元素 system.web 元素(ASP.NET 设置架构) profile 元素(ASP.NET 设置架构) profile 的 properties 元素(ASP.NET 设置架构)
<properties>
<add... />
<clear />
<remove... />
<group>...</group>
</properties>
下面几部分描述了属性、子元素和父元素。
属性
无。
子元素
|
元素
|
说明
|
| add | 可选的元素。 向用户配置文件添加属性。 |
| clear | 可选的元素。 从用户配置文件中清除以前定义的所有属性。 |
| group | 可选的元素。 定义用户配置文件属性的分组。 |
| remove | 可选的元素。 从用户配置文件中移除属性。 |
父元素
|
元素
|
说明
|
| configuration | 指定公共语言运行库和 .NET Framework 应用程序所使用的每个配置文件中均需要的根元素。 |
| system.web | 为 ASP.NET 配置节指定根元素。 |
| profile | 为应用程序配置用户配置文件。 |
有关访问和修改应用程序代码中 profile 元素的配置值的信息,请参见 ProfileSection。
下面的示例 Web.config 文件指定一个用户配置文件,该配置文件包含字符串类型的 ZipCode 属性和 StringCollection 类型的 RecentSearchList 属性。所生成的 Profile 将是每个指定属性的强类型访问器。有关用户配置文件的信息以及设置和读取用户配置文件属性的示例,请参见 ASP.NET 配置文件属性。
<configuration>
<connectionStrings>
<add name="SqlServices" connectionString="Data Source=localhost;Integrated Security=SSPI;Initial
Catalog=aspnetdb;" />
</connectionStrings>
<system.web>
<anonymousIdentification enabled="true" />
<profile defaultProvider="SqlProvider" >
<providers>
<add
name="SqlProvider"
connectionStringName="SqlServices"
applicationName="HttpProfileBaseApplication"
type="System.Web.Profile.SqlProfileProvider" />
</providers>
<properties>
<add name="ZipCode" allowAnonymous="true" />
<add name="RecentSearchList"
type="System.Collections.Specialized.StringCollection"
serializeAs="Xml"
allowAnonymous="true" />
</properties>
</profile>
</system.web>
</configuration>
任务
如何:锁定 ASP.NET 配置设置
参考
profile 元素(ASP.NET 设置架构)
system.web 元素(ASP.NET 设置架构)
<configuration> 元素
profile 的 properties 的 add 元素(ASP.NET 设置架构)
profile 的 properties 的 clear 元素(ASP.NET 设置架构)
profile 的 properties 的 group 元素(ASP.NET 设置架构)
profile 的 properties 的 remove 元素(ASP.NET 设置架构)
ProfileSection
System.Configuration
System.Web.Configuration
概念
ASP.NET 配置概述
ASP.NET Web 服务器控件和浏览器功能
保证 ASP.NET 配置的安全
ASP.NET 配置方案
其他资源
ASP.NET 配置文件属性
ASP.NET 配置文件
ASP.NET 配置设置
常规配置设置 (ASP.NET)
ASP.NET 配置 API