SqlProfileProvider クラス

定義

SQL Server データベース内にある ASP.NET アプリケーションに関するプロファイル情報のストレージを管理します。

public ref class SqlProfileProvider : System::Web::Profile::ProfileProvider
public class SqlProfileProvider : System.Web.Profile.ProfileProvider
type SqlProfileProvider = class
    inherit ProfileProvider
Public Class SqlProfileProvider
Inherits ProfileProvider
継承

次のコード例は、. を使用するように構成された ASP.NET アプリケーションのWeb.config ファイルをSqlProfileProvider示しています。

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

注釈

ASP.NET プロファイルは、データベースなどのデータ ソースにユーザー設定を格納および取得するために使用されます。 ユーザー プロファイルには、現在HttpContextのプロパティをProfile使用してアクセスします。 プロファイル情報とプロパティ値は、プロファイル プロバイダーを使用して管理されます。

このSqlProfileProviderクラスは、SQL Server データベースを使用している ASP.NET アプリケーションのプロファイル設定を格納および取得するために、ASP.NET によって使用されます。 をSqlProfileProvider使用するには、SQL Server SqlProfileProviderまず、 . 使用する SqlProfileProviderデータベースを作成するには、[drive:]\WINDOWS\Microsoft.NET\Framework\2.0versionNumber フォルダーにある aspnet_regsql.exe ツールを実行し、 -A p オプションを指定します。 次のコマンドは、aspnet_regsql.exe実行可能ファイルの使用方法を示しています。

aspnet_regsql.exe -A p  

上記の例では、作成されるデータベースの名前が指定されていないため、既定の名前が使用されます。 既定のデータベース名は Aspnetdb です。

マシン構成には、ローカル コンピューター上のSQL Serverに接続する AspNetSqlProvider という名前の既定SqlProfileProviderのインスタンスが含まれています。 プロバイダーのこのインスタンスを使用することも、ASP.NET アプリケーションのWeb.config ファイルで独自のインスタンスを指定することもできます。

注意

統合セキュリティを使用する接続文字列でプロファイル プロバイダーが構成されている場合、ASP.NET アプリケーションのプロセス アカウントには、SQL Server データベースに接続する権限が必要です。

コンストラクター

SqlProfileProvider()

SqlProfileProvider クラスのインスタンスを作成します。

プロパティ

ApplicationName

プロファイル情報を格納および取得するアプリケーションの名前を取得または設定します。

Description

管理ツールまたは他のユーザー インターフェイス (UI) での表示に適した、簡単でわかりやすい説明を取得します。

(継承元 ProviderBase)
Name

構成時にプロバイダーを参照するために使用される表示名を取得します。

(継承元 ProviderBase)

メソッド

DeleteInactiveProfiles(ProfileAuthenticationOption, DateTime)

最後のアクティビティの日付が指定した日時以前であるプロファイルの、ユーザー プロファイル データを削除します。

DeleteProfiles(ProfileInfoCollection)

指定されたプロファイル リストに該当するプロファイルのプロパティと情報をデータ ソースから削除します。

DeleteProfiles(String[])

指定されたユーザー名リストに該当するプロファイルのプロパティと情報をデータ ソースから削除します。

Equals(Object)

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
FindInactiveProfilesByUserName(ProfileAuthenticationOption, String, DateTime, Int32, Int32, Int32)

最後のアクティビティの日付が指定した日付またはそれ以前であり、プロファイルのユーザー名が指定した名前と一致するプロファイルのプロファイル情報を取得します。

FindProfilesByUserName(ProfileAuthenticationOption, String, Int32, Int32, Int32)

指定された名前にユーザー名が一致するプロファイルのプロファイル情報を取得します。

GetAllInactiveProfiles(ProfileAuthenticationOption, DateTime, Int32, Int32, Int32)

最後のアクティビティの日付が指定した日時またはそれ以前であるプロファイルの、ユーザー プロファイル データを取得します。

GetAllProfiles(ProfileAuthenticationOption, Int32, Int32, Int32)

データ ソース内にあるプロファイルのユーザー プロファイル データを取得します。

GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetNumberOfInactiveProfiles(ProfileAuthenticationOption, DateTime)

データ ソース内にある、最後のアクティビティの日付が指定された userInactiveSinceDate またはそれ以前であるプロファイルの数を取得します。

GetPropertyValues(SettingsContext, SettingsPropertyCollection)

SQL Server プロファイル データベースからプロファイル プロパティの情報と値を取得します。

GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
Initialize(String, NameValueCollection)

ASP.NET アプリケーションの構成ファイルで指定されたプロパティ値を使用して SQL Server プロファイル プロバイダーを初期化します。 このメソッドはコードから直接使用するためのものではありません。

MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
SetPropertyValues(SettingsContext, SettingsPropertyValueCollection)

指定されたプロパティ値で SQL Server プロファイル データベースを更新します。

ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

適用対象

こちらもご覧ください