请单击以进行评分并提供反馈
MSDN
MSDN Library
.NET 开发
先前版本
ASP.NET 参考
<system.web>
<profile>
<properties>

  开启低带宽视图
此页面仅适用于
Microsoft Visual Studio 2005/.NET Framework 2.0

同时提供下列产品的其他版本:
.NET Framework 常规参考
profile 的 properties 元素(ASP.NET 设置架构)

定义用户配置文件属性和属性组的集合。

此元素是 .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>

配置节处理程序

System.Web.Configuration.ProfileSection

配置成员

System.Web.Configuration.SystemWebSectionGroup.Profile

可配置的位置

Machine.config

根级别的 Web.config

应用程序级别的 Web.config

要求

Microsoft Internet 信息服务 (IIS) 版本 5.0、5.1 或 6.0

.NET Framework 2.0 版

Microsoft Visual Studio 2005

社区内容   什么是社区内容?
添加新内容 RSS  批注
Processing
© 2009 Microsoft Corporation 版权所有。 保留所有权利  |  商标  |  隐私权声明
Page view tracker