共用方式為


設定檔提供者的 clear 項目 (ASP.NET 設定結構描述)

更新:2007 年 11 月

移除使用者設定檔提供者集合的所有設定檔提供者執行個體。

這個項目是 .NET Framework 2.0 版中新增的項目。

<configuration> 項目
  system.web 項目 (ASP.NET 設定結構描述)
    profile 項目 (ASP.NET 設定結構描述)
      設定檔的 providers 項目 (ASP.NET 設定結構描述)
        設定檔提供者的 clear 項目 (ASP.NET 設定結構描述)

<clear/>

屬性和項目

下列小節描述屬性、子項目和父項目。

屬性

無。

子項目

無。

父項目

項目

說明

configuration

指定 Common Language Runtime 和 .NET Framework 應用程式所使用之每個組態檔中需要的根項目 (Root Element)。

system.web

指定 ASP.NET 組態區段的根項目。

profile

設定應用程式的使用者設定檔。

providers

為使用者設定檔定義設定檔提供者的集合。

備註

如需存取和修改應用程式程式碼中 profile 項目組態值的詳細資訊,請參閱 ProfileSection

範例

下列程式碼範例會示範如何設定 ASP.NET 應用程式,以便使用 SqlProfileProvider 提供者來儲存和擷取設定檔資訊。在加入 SqlProfileProvider 之前,<clear> 項目會清除 ProfileProviderCollection 集合。

<configuration>
  <connectionStrings>
    <add name="SqlServices" connectionString="Data Source=localhost;Integrated Security=SSPI;Initial 
         Catalog=aspnetdb;" />
  </connectionStrings>

  <system.web>
    <authentication mode="Forms" >
      <forms loginUrl="login.aspx" name=".ASPXFORMSAUTH" />
    </authentication>

    <authorization>
      <deny users="?" />
    </authorization>

    <membership defaultProvider="SqlProvider" userIsOnlineTimeWindow="15">
      <providers>
        <clear/>
        <add name="SqlProvider" 
             type="System.Web.Security.SqlMembershipProvider" 
             connectionStringName="SqlServices"
             applicationName="SampleApplication"
             enablePasswordRetrieval="true"
             enablePasswordReset="true"
             passwordFormat="Encrypted"
             requiresQuestionAndAnswer="true" />
      </providers>
    </membership>

    <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>
</configuration>

項目資訊

組態區段處理常式

System.Web.Configuration.ProfileSection

組態成員

ProfileSection.Providers

可設定的位置

Machine.config

根層級的 Web.config

應用程式層級的 Web.config

需求

Microsoft Internet Information Services (IIS) 5.0、5.1 或 6.0 版

.NET Framework 2.0 版

Microsoft Visual Studio 2005

請參閱

工作

HOW TO:鎖定 ASP.NET 組態設定

概念

ASP.NET 設定檔屬性概觀

ASP.NET 組態概觀

ASP.NET Web 伺服器控制項和瀏覽器能力

保護 ASP.NET 組態

ASP.NET 組態案例

參考

profile 項目 (ASP.NET 設定結構描述)

system.web 項目 (ASP.NET 設定結構描述)

<configuration> 項目

設定檔提供者的 add 項目 (ASP.NET 設定結構描述)

設定檔提供者的 remove 項目 (ASP.NET 設定結構描述)

ProfileSection

System.Configuration

System.Web.Configuration

其他資源

ASP.NET 組態檔

ASP.NET 組態設定

一般組態設定 (ASP.NET)

ASP.NET 組態 API