profile 要素 (ASP.NET 設定スキーマ)

[このドキュメントはプレビューのみを目的としており、以降のリリースで変更される可能性があります。プレースホルダーとして空白のトピックが含まれています。]

ASP.NET プロファイルを使用してユーザー プロファイル値を管理するためのパラメーターを構成します。

この要素は、.NET Framework Version 2.0 で追加されました。

<profile
    enabled="true|false"
    inherits="fully qualified type reference"
    automaticSaveEnabled="true|false"
    defaultProvider="provider name">
    <properties>...</properties>
    <providers>...</providers>
</profile>

属性および要素

以降のセクションでは、属性、子要素、および親要素について説明します。

属性

属性

Description

enabled

省略可能な Boolean 型の属性です。

ASP.NET ユーザー プロファイルを有効にするかどうかを指定します。 true の場合、ASP.NET ユーザー プロファイルは有効になります。

既定値は、true です。

defaultProvider

省略可能な String 属性です。

既定のプロファイル プロバイダーの名前を指定します。

詳細については、「Provider」を参照してください。

既定値は、AspNetSqlProfileProvider です。

inherits

省略可能な String 属性です。

ProfileBase 抽象クラスから派生したカスタム型への型参照を格納します。 ASP.NET は、この型から継承する ProfileCommon クラスを動的に生成し、現在の HttpContextProfile プロパティに配置します。

automaticSaveEnabled

省略可能な Boolean 型の属性です。

ASP.NET ページの実行終了時にユーザー プロファイルを自動的に保存するかどうかを指定します。 true の場合、ASP.NET ページの実行終了時にユーザー プロファイルを自動的に保存します。

ProfileModule オブジェクトは、プロファイルが変更されたことがモジュールにより検出された場合だけユーザー プロファイルを保存します。 つまり、IsDirty プロパティは true です。 詳細については、「ASP.NET Profile Properties Overview」を参照してください。

既定値は、true です。

子要素

要素

Description

properties

必須の要素。

ユーザー プロファイル プロパティおよびプロパティ グループのコレクションを定義します。

providers

省略可能な要素です。

プロファイル プロバイダーのコレクションを定義します。

親要素

要素

Description

configuration

共通言語ランタイムおよび .NET Framework アプリケーションで使用されるすべての構成ファイルで必要なルート要素を指定します。

system.web

ASP.NET 構成セクションのルート要素を指定します。

解説

アプリケーション コード内の profile 要素の構成値のアクセスおよび変更方法については、ProfileSection クラスを参照してください。

既定の構成

次の既定の profile 要素は、.NET Framework Version 2.0 の Machine.config ファイルで構成されます。

<profile>
  <providers>
        <add name="AspNetSqlProfileProvider" connectionStringName="LocalSqlServer" applicationName="/" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> 
  </providers>
</profile>

使用例

SqlProfileProvider プロバイダーを使用する ASP.NET アプリケーションの Web.config ファイルの構成方法を次のコード例に示します。

<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

構成メンバー

SystemWebSectionGroup.Profile

構成できる場所

Machine.config

ルート レベルの Web.config

アプリケーション レベルの Web.config

要件

Microsoft Internet Information Services (IIS) バージョン 5.0、5.1、または 6.0

.NET Framework Version 2.0

Microsoft Visual Studio 2005

参照

処理手順

How to: Lock ASP.NET Configuration Settings

Reference

system.web 要素 (ASP.NET 設定スキーマ)

<configuration> 要素

profile の properties 要素 (ASP.NET 設定スキーマ)

profile の providers 要素 (ASP.NET 設定スキーマ)

ProfileSection

System.Configuration

System.Web.Configuration

概念

ASP.NET Profile Properties Overview

ASP.NET Configuration Overview

ASP.NET Server Controls and Browser Capabilities

Securing Configuration

Configuration Inheritance

その他の技術情報

ASP.NET Configuration Files

ASP.NET 構成設定

全般構成設定 (ASP.NET)

ASP.NET Configuration API