profile の providers の add 要素 (ASP.NET 設定スキーマ)
[このドキュメントはプレビューのみを目的としており、以降のリリースで変更される可能性があります。プレースホルダーとして空白のトピックが含まれています。]
プロファイル プロバイダー インスタンスをユーザー プロファイル プロバイダー コレクションに追加します。
この要素は、.NET Framework Version 2.0 で追加されました。
<add
name="provider name"
type="fully qualified type reference"
connectionStringName="connection string identifier"
commandTimeout="number of seconds before a command times out"
description="description of the provider instance"
applicationName="application name for stored profile information" />
属性および要素
以降のセクションでは、属性、子要素、および親要素について説明します。
属性
属性 |
Description |
---|---|
name |
必須の String 属性です。 プロバイダーのインスタンスの名前を指定します。 この値は、プロバイダー インスタンスを既定のプロファイル プロバイダーとして識別するために、<profile> 要素の defaultProvider 属性に使用します。 プロバイダーの name は、Providers コレクション内のプロバイダーにインデックスを付けるためにも使用します。 |
type |
必須の String 属性です。 ProfileProvider 抽象基本クラスを実装する型を指定します。 |
connectionStringName |
必須の String 属性です。 <connectionStrings> 要素に定義されている接続文字列の名前を指定します。 指定した接続文字列は、追加されるプロバイダーによって使用されます。 |
applicationName |
省略可能な String 属性です。 プロファイル データがデータ ソースに格納される際に使用されるアプリケーション名を指定します。 アプリケーション名を指定すると、複数の ASP.NET アプリケーションで同じデータベースを使用できます。プロファイル データは異なるアプリケーションごとに複製されません。 また、同じアプリケーション名を指定すると、複数の ASP.NET アプリケーションで同じプロファイル情報を使用できます。 この属性を指定しない場合、.NET Framework に含まれるプロファイル プロバイダーは、ApplicationName プロパティに対して ApplicationVirtualPath 値を使用します。 |
commandTimeout |
省略可能な Int32 型の属性です。 メンバーシップ データ ソースに対して実行されたコマンドがタイムアウトするまでの時間を秒単位で指定します。 このタイムアウト値は、SQL プロバイダーが SqlCommand オブジェクトを作成するときに使用します。 既定では、この属性は ASP.NET 構成では設定されていません。 したがって、ADO.NET の既定である 30 秒が使用されます。 この属性が設定されると、SQL プロバイダーは、データベースに対して実行されるすべての SQL コマンドについて、構成されたタイムアウト値を使用します。 既定値は 30 です (ADO.NET の既定値)。 |
description |
省略可能な String 属性です。 プロファイル プロバイダー インスタンスの説明を入力します。 |
子要素
なし。
親要素
要素 |
Description |
---|---|
providers |
ユーザー プロファイルのプロファイル プロバイダーのコレクションを定義します。 |
profile |
アプリケーションのユーザー プロファイルを構成します。 |
configuration |
共通言語ランタイムおよび .NET Framework アプリケーションで使用されるすべての構成ファイルのルート要素を指定します。 |
system.web |
ASP.NET 構成セクションのルート要素を指定します。 |
解説
カスタム プロファイル プロバイダー実装の add 要素に追加の属性を含めることができます。 例については、「Sample Profile Provider Implementation」を参照してください。
アプリケーション コード内の profile 要素の構成値のアクセスおよび変更方法については、ProfileSection クラスを参照してください。
既定の構成
次の既定の profile 要素は、.NET Framework Version 2.0 の Machine.config ファイルで構成されます。
<providers>
<add name="AspNetSqlProfileProvider" connectionStringName="LocalSqlServer" applicationName="/" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
使用例
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>
要素情報
構成セクション ハンドラー |
|
構成メンバー |
|
構成できる場所 |
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 設定スキーマ)
profile の providers の remove 要素 (ASP.NET 設定スキーマ)
profile の providers の clear 要素 (ASP.NET 設定スキーマ)
概念
ASP.NET Profile Properties Overview
ASP.NET Configuration Overview
ASP.NET Server Controls and Browser Capabilities
Securing ASP.NET Configuration
ASP.NET Configuration Scenarios