WebConfigurationManager.GetWebApplicationSection メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > WebConfigurationManager.GetWebApplicationSection メソッドの意味・解説 

WebConfigurationManager.GetWebApplicationSection メソッド

メモ : このメソッドは、.NET Framework version 2.0新しく追加されたものです。

現在の Web アプリケーション構成ファイルの、指定した構成セクション取得します

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

Public Shared Function GetWebApplicationSection
 ( _
    sectionName As String _
) As Object
Dim sectionName As String
Dim returnValue As Object

returnValue = WebConfigurationManager.GetWebApplicationSection(sectionName)
public static Object GetWebApplicationSection
 (
    string sectionName
)
public:
static Object^ GetWebApplicationSection (
    String^ sectionName
)
public static Object GetWebApplicationSection
 (
    String sectionName
)
public static function GetWebApplicationSection
 (
    sectionName : String
) : Object

パラメータ

sectionName

構成セクション名。

戻り値
指定した構成セクション オブジェクト指定したセクション存在しない場合null 参照 (Visual Basic では Nothing)。このセクション実行時アクセスできない場合内部オブジェクト

例外例外
例外種類条件

ConfigurationErrorsException

有効な構成ファイル読み込むことができませんでした

解説解説
使用例使用例

GetWebApplicationSection メソッド使用して構成情報アクセスする方法次のコード例示します

' Show the use of GetWebApplicationSection(string). 
' If called from within a Web aplication it gets the
' section from the configuration file located at the 
' application current level.
' Its behavior is similar to GetSection(string)
Shared Sub GetWebApplicationSection()
   
   ' Get the default connectionStrings section,
     Dim connectionStringsSection As ConnectionStringsSection
 = _
     WebConfigurationManager.GetWebApplicationSection( _
     "connectionStrings")
   
   ' Get the connectionStrings key,value pairs collection.
     Dim connectionStrings As ConnectionStringSettingsCollection
 = _
     connectionStringsSection.ConnectionStrings
   
   ' Get the collection enumerator.
     Dim connectionStringsEnum As IEnumerator
 = _
     connectionStrings.GetEnumerator()
   
   ' Loop through the collection and 
   ' display the connectionStrings key, value pairs.
   Dim i As Integer = 0
   Console.WriteLine("[Display connectionStrings]")
   While connectionStringsEnum.MoveNext()
      Dim name As String
 = connectionStrings(i).Name
         Console.WriteLine("Name: {0} Value: {1}",
 _
         name, connectionStrings(name))
      i += 1
   End While
   
   Console.WriteLine()
End Sub 'GetWebApplicationSection


// Show the use of GetWebApplicationSection(string). 
// If called from within a Web aplication it gets the
// section from the configuration file located at the 
// application current level.
// Its behavior is similar to GetSection(string)
static void GetWebApplicationSection()
{

    // Get the default connectionStrings section,
    ConnectionStringsSection connectionStringsSection =
        WebConfigurationManager.GetWebApplicationSection(
        "connectionStrings") as ConnectionStringsSection;

    // Get the connectionStrings key,value pairs collection.
    ConnectionStringSettingsCollection connectionStrings =
        connectionStringsSection.ConnectionStrings;

    // Get the collection enumerator.
    IEnumerator connectionStringsEnum =
        connectionStrings.GetEnumerator();

    // Loop through the collection and 
    // display the connectionStrings key, value pairs.
    int i = 0;
    Console.WriteLine("[Display connectionStrings]");
    while (connectionStringsEnum.MoveNext())
    {
        string name = connectionStrings[i].Name;
        Console.WriteLine("Name: {0} Value: {1}",
        name, connectionStrings[name]);
        i += 1;
    }

    Console.WriteLine();
}

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
WebConfigurationManager クラス
WebConfigurationManager メンバ
System.Web.Configuration 名前空間
ConfigurationSection


このページでは「.NET Framework クラス ライブラリ リファレンス」からWebConfigurationManager.GetWebApplicationSection メソッドを検索した結果を表示しています。
Weblioに収録されているすべての辞書からWebConfigurationManager.GetWebApplicationSection メソッドを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からWebConfigurationManager.GetWebApplicationSection メソッド を検索

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

辞書ショートカット

すべての辞書の索引

「WebConfigurationManager.GetWebApplicationSection メソッド」の関連用語

WebConfigurationManager.GetWebApplicationSection メソッドのお隣キーワード
検索ランキング

   

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



WebConfigurationManager.GetWebApplicationSection メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS