HttpModuleCollection クラス
アセンブリ: System.Web (system.web.dll 内)


HttpModuleCollection クラスの AllKeys プロパティおよび GetKey メソッドと CopyTo メソッドを次のコード例に示します。この例では、現在の要求のアプリケーション オブジェクトを現在の HttpContext オブジェクトから取得します。次に、HttpModuleCollection オブジェクトをアプリケーション インスタンスから抽出し、IHttpModule オブジェクトの名前を表示します。
<%@ Page language="VB" %> <%@ Import Namespace = "System.Data" %> <HTML> <HEAD> <script runat="server"> ' System.Web.HttpModuleCollection.AllKeys;GetKey;CopyTo Sub Page_Load(Sender As Object, e As EventArgs ) ' Get the HttpContext object for the current request. Dim i As Integer Dim myHttpContext As HttpContext = HttpContext.Current ' Get the application object for the current request. Dim myHttpApplication As HttpApplication = myHttpContext.ApplicationInstance ' Get the collection of all HTTPModule objects for the current application. Dim myHttpModuleCollection As HttpModuleCollection = myHttpApplication.Modules ' Get the name of the HttpModule object at index 1. Dim httpModuleName As string = myHttpModuleCollection.GetKey(1) Response.Write("The name of the HttpModule object at index 1" + " is " +"'"+ httpModuleName+"'." + "<br><br>") Dim allModules() As string = myHttpModuleCollection.AllKeys ' Display the names of all HttpModule objects. Response.Write("<b>The HttpModule objects of HttpModuleCollection are:</b><br>") For i = 0 To allModules.Length -1 Response.Write("Module" + i.ToString() + " : " + allModules(i).ToString() + "<br>") Next i ' Copy the HttpModule objects in the collection into an array. Dim httpModuleArray As System.Array = Array.CreateInstance(GetType(object) ,myHttpModuleCollection.AllKeys.Length) myHttpModuleCollection.CopyTo(httpModuleArray,0) Response.Write("<br><br><b>Successfully copied the HttpModule objects in the HttpModuleCollection to an array."+ "<br>Displaying the HttpModule objects in the array:</b><br>") For i=0 To httpModuleArray.Length -1 Response.Write("Module" + i.ToString() + ": " + httpModuleArray.GetValue(i).ToString() + "<br>") Next i End Sub </script> </HEAD> </HTML>
<%@ Page language="C#" %> <%@ Import Namespace = "System.Data" %> <HTML> <HEAD> <script runat="server"> // System.Web.HttpModuleCollection.AllKeys;GetKey;CopyTo void Page_Load(object sender, System.EventArgs e) { // Get the HttpContext object for the current request. HttpContext myHttpContext = HttpContext.Current; // Get the application object for the current request. HttpApplication myHttpApplication = myHttpContext.ApplicationInstance; // Get the collection of all HTTPModule objects for the current application. HttpModuleCollection myHttpModuleCollection = myHttpApplication.Modules; // Get the name of the HttpModule object at index 1. string httpModuleName = myHttpModuleCollection.GetKey(1); Response.Write("The name of the HttpModule object at index 1" + " is " +"'"+ httpModuleName+"'." + "<br><br>"); string[] allModules = myHttpModuleCollection.AllKeys; // Display the names of all HttpModule objects. Response.Write("<b>The HttpModule objects contained in the HttpModuleCollection are:</b><br>"); for(int i=0; i < allModules.Length; i++) Response.Write("Module" + i + " : " + allModules[i] + "<br>"); // Copy the HttpModule objects in the collection into an array. System.Array httpModuleArray = Array.CreateInstance(typeof(object),myHttpModuleCollection.AllKeys.Length); myHttpModuleCollection.CopyTo(httpModuleArray,0); Response.Write("<br><br><b>Successfully copied the HttpModule objects in the HttpModuleCollection to an array."+ "<br>Displaying the HttpModule objects in array:</b><br>"); for(int i=0; i < httpModuleArray.Length; i++) Response.Write("Module" + i + ": " + httpModuleArray.GetValue(i) + "<br>"); } </script> </HEAD> </HTML>
<%@ Page language="VJ#" %> <%@ Import Namespace = "System.Data" %> <HTML> <HEAD> <script runat="server"> // System.Web.HttpModuleCollection.AllKeys;GetKey;CopyTo void Page_Load(Object sender, System.EventArgs e) { // The following example demonstrates the AllKeys property and the GetKey and // CopyTo methods of the HttpModuleCollection class. The example gets the // application object for the current request from the current HttpContext // object. It then extracts the HttpModuleCollection object from the // application instance and displays the names of the HttpModule objects. // Get the HttpContext object for the current request. HttpContext myHttpContext = HttpContext.get_Current(); // Get the application object for the current request. HttpApplication myHttpApplication = myHttpContext.get_ApplicationInstance(); // Get the collection of all HTTPModule objects for the current application. HttpModuleCollection myHttpModuleCollection = myHttpApplication.get_Modules(); // Get the name of the HttpModule object at index 1. String httpModuleName = myHttpModuleCollection.GetKey(1); get_Response().Write("The name of the HttpModule object at index 1" + " is " +"'"+ httpModuleName+"'." + "<br><br>"); String allModules[] = myHttpModuleCollection.get_AllKeys(); // Display the names of all HttpModule objects. get_Response().Write("<b>The HttpModule objects contained in the " + "HttpModuleCollection are:</b><br>"); for(int i=0; i < allModules.get_Length(); i++) { get_Response().Write("Module" + i + " : " + allModules[i] + "<br>"); } // Copy the HttpModule objects in the collection into an array. System.Array httpModuleArray = Array.CreateInstance(Object.class.ToType() , myHttpModuleCollection.get_AllKeys().get_Length()); myHttpModuleCollection.CopyTo(httpModuleArray,0); get_Response().Write("<br><br><b>Successfully copied the HttpModule " + "objects in the HttpModuleCollection to an array." + "<br>Displaying the HttpModule objects in array:</b><br>"); for(int i=0; i < httpModuleArray.get_Length(); i++) { get_Response().Write("Module" + i + ": " + httpModuleArray.GetValue(i) + "<br>"); } } // Page_Load </script> </HEAD> </HTML>


System.Collections.Specialized.NameObjectCollectionBase
System.Web.HttpModuleCollection


Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


HttpModuleCollection プロパティ

名前 | 説明 | |
---|---|---|
![]() | AllKeys | HttpModuleCollection 内のすべてのキー (モジュール名) を格納している文字列配列を取得します。 |
![]() | Count | NameObjectCollectionBase インスタンスに格納されているキーと値のペアの数を取得します。 ( NameObjectCollectionBase から継承されます。) |
![]() | Item | オーバーロードされます。 指定した IHttpModule オブジェクトを HttpModuleCollection から取得します。 |
![]() | Keys | NameObjectCollectionBase インスタンス内のすべてのキーを格納する NameObjectCollectionBase.KeysCollection インスタンスを取得します。 ( NameObjectCollectionBase から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | IsReadOnly | NameObjectCollectionBase インスタンスが読み取り専用かどうかを示す値を取得または設定します。 ( NameObjectCollectionBase から継承されます。) |

HttpModuleCollection メソッド

名前 | 説明 | |
---|---|---|
![]() | CopyTo | 配列の指定したインデックスを開始点として、Array にモジュール コレクションのメンバをコピーします。 |
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。) |
![]() | Get | オーバーロードされます。 それぞれの IHttpModule オブジェクトをHttpModuleCollection から返します。 |
![]() | GetEnumerator | NameObjectCollectionBase を反復処理する列挙子を返します。 ( NameObjectCollectionBase から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。) |
![]() | GetKey | 指定した数値インデックスの IHttpModule オブジェクトのキー (名前) を返します。 |
![]() | GetObjectData | ISerializable インターフェイスを実装し、NameObjectCollectionBase インスタンスをシリアル化するために必要なデータを返します。 ( NameObjectCollectionBase から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | OnDeserialization | ISerializable インターフェイスを実装し、逆シリアル化が完了したときに逆シリアル化イベントを発生させます。 ( NameObjectCollectionBase から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | BaseAdd | 指定したキーと値を持つエントリを NameObjectCollectionBase インスタンスに追加します。 ( NameObjectCollectionBase から継承されます。) |
![]() | BaseClear | NameObjectCollectionBase インスタンスからすべてのエントリを削除します。 ( NameObjectCollectionBase から継承されます。) |
![]() | BaseGet | オーバーロードされます。 NameObjectCollectionBase インスタンスから、指定したエントリの値を取得します。 ( NameObjectCollectionBase から継承されます。) |
![]() | BaseGetAllKeys | NameObjectCollectionBase インスタンス内のすべてのキーを格納する String 配列を返します。 ( NameObjectCollectionBase から継承されます。) |
![]() | BaseGetAllValues | オーバーロードされます。 NameObjectCollectionBase インスタンス内のすべての値を格納する配列を返します。 ( NameObjectCollectionBase から継承されます。) |
![]() | BaseGetKey | NameObjectCollectionBase インスタンスの指定したインデックスにあるエントリのキーを取得します。 ( NameObjectCollectionBase から継承されます。) |
![]() | BaseHasKeys | NameObjectCollectionBase インスタンスが、キーが null 参照 (Visual Basic では Nothing) ではないエントリを格納しているかどうかを示す値を取得します。 ( NameObjectCollectionBase から継承されます。) |
![]() | BaseRemove | 指定したキーを持つエントリを NameObjectCollectionBase インスタンスから削除します。 ( NameObjectCollectionBase から継承されます。) |
![]() | BaseRemoveAt | NameObjectCollectionBase インスタンスの指定したインデックスにあるエントリを削除します。 ( NameObjectCollectionBase から継承されます。) |
![]() | BaseSet | オーバーロードされます。 NameObjectCollectionBase インスタンス内のエントリの値を設定します。 ( NameObjectCollectionBase から継承されます。) |
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

HttpModuleCollection メンバ
IHttpModule オブジェクトのコレクションに対して、インデックス付けおよび取得を実行できるようにする手段を提供します。
HttpModuleCollection データ型で公開されるメンバを以下の表に示します。

名前 | 説明 | |
---|---|---|
![]() | AllKeys | HttpModuleCollection 内のすべてのキー (モジュール名) を格納している文字列配列を取得します。 |
![]() | Count | NameObjectCollectionBase インスタンスに格納されているキーと値のペアの数を取得します。(NameObjectCollectionBase から継承されます。) |
![]() | Item | オーバーロードされます。 指定した IHttpModule オブジェクトを HttpModuleCollection から取得します。 |
![]() | Keys | NameObjectCollectionBase インスタンス内のすべてのキーを格納する NameObjectCollectionBase.KeysCollection インスタンスを取得します。(NameObjectCollectionBase から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | IsReadOnly | NameObjectCollectionBase インスタンスが読み取り専用かどうかを示す値を取得または設定します。(NameObjectCollectionBase から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | CopyTo | 配列の指定したインデックスを開始点として、Array にモジュール コレクションのメンバをコピーします。 |
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。) |
![]() | Get | オーバーロードされます。 それぞれの IHttpModule オブジェクトをHttpModuleCollection から返します。 |
![]() | GetEnumerator | NameObjectCollectionBase を反復処理する列挙子を返します。 (NameObjectCollectionBase から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。) |
![]() | GetKey | 指定した数値インデックスの IHttpModule オブジェクトのキー (名前) を返します。 |
![]() | GetObjectData | ISerializable インターフェイスを実装し、NameObjectCollectionBase インスタンスをシリアル化するために必要なデータを返します。 (NameObjectCollectionBase から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | OnDeserialization | ISerializable インターフェイスを実装し、逆シリアル化が完了したときに逆シリアル化イベントを発生させます。 (NameObjectCollectionBase から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | BaseAdd | 指定したキーと値を持つエントリを NameObjectCollectionBase インスタンスに追加します。 (NameObjectCollectionBase から継承されます。) |
![]() | BaseClear | NameObjectCollectionBase インスタンスからすべてのエントリを削除します。 (NameObjectCollectionBase から継承されます。) |
![]() | BaseGet | オーバーロードされます。 NameObjectCollectionBase インスタンスから、指定したエントリの値を取得します。 (NameObjectCollectionBase から継承されます。) |
![]() | BaseGetAllKeys | NameObjectCollectionBase インスタンス内のすべてのキーを格納する String 配列を返します。 (NameObjectCollectionBase から継承されます。) |
![]() | BaseGetAllValues | オーバーロードされます。 NameObjectCollectionBase インスタンス内のすべての値を格納する配列を返します。 (NameObjectCollectionBase から継承されます。) |
![]() | BaseGetKey | NameObjectCollectionBase インスタンスの指定したインデックスにあるエントリのキーを取得します。 (NameObjectCollectionBase から継承されます。) |
![]() | BaseHasKeys | NameObjectCollectionBase インスタンスが、キーが null 参照 (Visual Basic では Nothing) ではないエントリを格納しているかどうかを示す値を取得します。 (NameObjectCollectionBase から継承されます。) |
![]() | BaseRemove | 指定したキーを持つエントリを NameObjectCollectionBase インスタンスから削除します。 (NameObjectCollectionBase から継承されます。) |
![]() | BaseRemoveAt | NameObjectCollectionBase インスタンスの指定したインデックスにあるエントリを削除します。 (NameObjectCollectionBase から継承されます。) |
![]() | BaseSet | オーバーロードされます。 NameObjectCollectionBase インスタンス内のエントリの値を設定します。 (NameObjectCollectionBase から継承されます。) |
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

- HttpModuleCollectionのページへのリンク