Roles.Providers プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > Roles.Providers プロパティの意味・解説 

Roles.Providers プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

ASP.NET アプリケーションロール プロバイダコレクション取得します

名前空間: System.Web.Security
アセンブリ: System.Web (system.web.dll 内)
構文構文

Public Shared ReadOnly Property
 Providers As RoleProviderCollection
Dim value As RoleProviderCollection

value = Roles.Providers
public static RoleProviderCollection Providers
 { get; }
public:
static property RoleProviderCollection^ Providers {
    RoleProviderCollection^ get ();
}
/** @property */
public static RoleProviderCollection get_Providers
 ()
public static function get
 Providers () : RoleProviderCollection

プロパティ
ASP.NET アプリケーション用に構成されロール プロバイダを含む RoleProviderCollection。

例外例外
例外種類条件

System.Configuration.Provider.ProviderException

ロール管理有効になっていません。

解説解説

Providers プロパティは、Web.config ファイル追加されているすべてのプロバイダ含めてアプリケーションに対して有効になっているすべてのロール プロバイダ参照します。アプリケーション使用可能にするロール プロバイダは、アプリケーションの Web.config ファイルの roleManager セクションproviders 要素使用して制御できます

Machine.config ファイル指定したプロバイダなどの既存プロバイダ削除し、SqlRoleProvider インスタンスアプリケーションロール プロバイダとして追加する roleManager セクションコード例次に示します

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

  <system.web>
    <roleManager defaultProvider="SqlProvider" 
      enabled="true"
      cacheRolesInCookie="true"
      cookieName=".ASPROLES"
      cookieTimeout="30"
      cookiePath="/"
      cookieRequireSSL="false"
      cookieSlidingExpiration="true"
      cookieProtection="Encrypted">

      <providers>
        <clear/>
        <add
          name="SqlProvider"
          type="System.Web.Security.SqlRoleProvider"
          connectionStringName="SqlServices"
          applicationName="MyApplication" />
         </providers>

    </roleManager>
  </system.web>
</configuration>

ロール プロバイダ対し前によるインデックス付け必要な型としてキャストすることによって、Providers コレクションからプロバイダへの厳密に指定され参照取得できます

Provider プロパティ使用すると、アプリケーション既定プロバイダへの参照取得できます

使用例使用例

アプリケーションに対して有効なプロバイダとそれらの種類リストするコードの例次に示します

<%@ Page Language="VB" %>
<%@ Import Namespace="System.Web.Security"
 %>
<%@ Import Namespace="System.Configuration.Provider"
 %>
<html>
<head>
<title>List Enabled Providers</title>
</head>
<body>

<%
For Each p As RoleProvider
 In Roles.Providers
  Response.Write(p.Name & ", " & p.GetType().ToString()
 & "<BR>")
Next
%>

</body>
</html>
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Web.Security" %>
<%@ Import Namespace="System.Configuration.Provider" %>
<html>
<head>
<title>List Enabled Providers</title>
</head>
<body>

<%
foreach (RoleProvider p in Roles.Providers)
  Response.Write(p.Name + ", " + p.GetType() + "<BR>");
%>

</body>
</html>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「Roles.Providers プロパティ」の関連用語

Roles.Providers プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



Roles.Providers プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS