HttpModuleCollection 클래스

정의

IHttpModule 개체의 컬렉션을 인덱싱하고 검색하는 방법을 제공합니다.

public ref class HttpModuleCollection sealed : System::Collections::Specialized::NameObjectCollectionBase
public sealed class HttpModuleCollection : System.Collections.Specialized.NameObjectCollectionBase
type HttpModuleCollection = class
    inherit NameObjectCollectionBase
Public NotInheritable Class HttpModuleCollection
Inherits NameObjectCollectionBase
상속
HttpModuleCollection

예제

다음 코드 예제는 AllKeys 속성 및 GetKeyCopyTo 의 메서드는 HttpModuleCollection 클래스입니다. 이 예제에서는 현재에서 현재 요청에 대 한 애플리케이션 개체를 가져옵니다 HttpContext 개체입니다. 추출 합니다는 HttpModuleCollection 애플리케이션 인스턴스에서 개체의 이름을 표시 하 고는 IHttpModule 개체입니다.

<%@ Page language="C#" %>
<%@ Import Namespace = "System.Data"  %>
<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>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>HttpModuleCollection Example</title>
</head>
<body>
</body>
</html>
<%@ Page language="VB" %>
<%@ Import Namespace = "System.Data"  %>

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>HttpModuleCollection Example</title>
</head>
<body>
</body>
</html>

속성

AllKeys

HttpModuleCollection의 키(모듈 이름)가 모두 들어 있는 문자열 배열을 가져옵니다.

Count

NameObjectCollectionBase 인스턴스에 포함된 키/값 쌍의 수를 가져옵니다.

(다음에서 상속됨 NameObjectCollectionBase)
IsReadOnly

NameObjectCollectionBase 인스턴스가 읽기 전용인지 여부를 나타내는 값을 가져오거나 설정합니다.

(다음에서 상속됨 NameObjectCollectionBase)
Item[Int32]

IHttpModule에서 지정된 숫자 인덱스를 사용하여 HttpModuleCollection 개체를 가져옵니다.

Item[String]

IHttpModule에서 지정된 이름을 가진 HttpModuleCollection 개체를 가져옵니다.

Keys

NameObjectCollectionBase.KeysCollection 인스턴스의 모든 키를 포함하는 NameObjectCollectionBase 인스턴스를 가져옵니다.

(다음에서 상속됨 NameObjectCollectionBase)

메서드

BaseAdd(String, Object)

지정한 키와 값을 가지는 엔트리를 NameObjectCollectionBase 인스턴스에 추가합니다.

(다음에서 상속됨 NameObjectCollectionBase)
BaseClear()

NameObjectCollectionBase 인스턴스에서 모든 엔트리를 제거합니다.

(다음에서 상속됨 NameObjectCollectionBase)
BaseGet(Int32)

NameObjectCollectionBase 인스턴스의 지정한 인덱스에서 엔트리의 값을 가져옵니다.

(다음에서 상속됨 NameObjectCollectionBase)
BaseGet(String)

NameObjectCollectionBase 인스턴스에서 지정한 키를 갖는 첫 번째 엔트리 값을 가져옵니다.

(다음에서 상속됨 NameObjectCollectionBase)
BaseGetAllKeys()

NameObjectCollectionBase 인스턴스의 모든 키를 포함하는 String 배열을 반환합니다.

(다음에서 상속됨 NameObjectCollectionBase)
BaseGetAllValues()

NameObjectCollectionBase 인스턴스의 모든 값을 포함하는 Object 배열을 반환합니다.

(다음에서 상속됨 NameObjectCollectionBase)
BaseGetAllValues(Type)

NameObjectCollectionBase 인스턴스의 모든 값을 포함하는 지정한 형식의 배열을 반환합니다.

(다음에서 상속됨 NameObjectCollectionBase)
BaseGetKey(Int32)

NameObjectCollectionBase 인스턴스의 지정한 인덱스에서 엔트리의 키를 가져옵니다.

(다음에서 상속됨 NameObjectCollectionBase)
BaseHasKeys()

NameObjectCollectionBase 인스턴스에 null이 아닌 키를 갖는 엔트리가 있는지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 NameObjectCollectionBase)
BaseRemove(String)

NameObjectCollectionBase 인스턴스에서 지정한 키를 가지는 엔트리를 제거합니다.

(다음에서 상속됨 NameObjectCollectionBase)
BaseRemoveAt(Int32)

NameObjectCollectionBase 인스턴스의 지정한 인덱스에서 엔트리를 제거합니다.

(다음에서 상속됨 NameObjectCollectionBase)
BaseSet(Int32, Object)

NameObjectCollectionBase 인스턴스의 지정한 인덱스에서 엔트리의 값을 설정합니다.

(다음에서 상속됨 NameObjectCollectionBase)
BaseSet(String, Object)

지정한 키를 갖는 엔트리가 NameObjectCollectionBase 인스턴스에 있으면 첫 번째 엔트리의 값을 설정하고, 그러지 않으면 지정한 키와 값을 갖는 엔트리를 NameObjectCollectionBase 인스턴스에 추가합니다.

(다음에서 상속됨 NameObjectCollectionBase)
CopyTo(Array, Int32)

지정된 배열의 인덱스부터 시작하여 모듈 컬렉션의 멤버를 Array에 복사합니다.

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
Get(Int32)

IHttpModule에서 지정된 인덱스에 해당하는 HttpModuleCollection 개체를 반환합니다.

Get(String)

IHttpModule에서 지정된 이름을 가진 HttpModuleCollection 개체를 반환합니다.

GetEnumerator()

NameObjectCollectionBase를 반복하는 열거자를 반환합니다.

(다음에서 상속됨 NameObjectCollectionBase)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetKey(Int32)

지정된 숫자 인덱스에 있는 IHttpModule 개체의 키(이름)를 반환합니다.

GetObjectData(SerializationInfo, StreamingContext)

ISerializable 인터페이스를 구현하고 NameObjectCollectionBase 인스턴스를 직렬화하는 데 필요한 데이터를 반환합니다.

(다음에서 상속됨 NameObjectCollectionBase)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
OnDeserialization(Object)

ISerializable 인터페이스를 구현하고, deserialization이 완료되면 deserialization 이벤트를 발생시킵니다.

(다음에서 상속됨 NameObjectCollectionBase)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

명시적 인터페이스 구현

ICollection.CopyTo(Array, Int32)

대상 배열의 지정된 인덱스에서 시작하여 전체 NameObjectCollectionBase을 호환되는 1차원 Array에 복사합니다.

(다음에서 상속됨 NameObjectCollectionBase)
ICollection.IsSynchronized

NameObjectCollectionBase 개체에 대한 액세스가 동기화되어 스레드로부터 안전하게 보호되는지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 NameObjectCollectionBase)
ICollection.SyncRoot

NameObjectCollectionBase 개체에 대한 액세스를 동기화하는 데 사용할 수 있는 개체를 가져옵니다.

(다음에서 상속됨 NameObjectCollectionBase)

확장 메서드

Cast<TResult>(IEnumerable)

IEnumerable의 요소를 지정된 형식으로 캐스팅합니다.

OfType<TResult>(IEnumerable)

지정된 형식에 따라 IEnumerable의 요소를 필터링합니다.

AsParallel(IEnumerable)

쿼리를 병렬화할 수 있도록 합니다.

AsQueryable(IEnumerable)

IEnumerableIQueryable로 변환합니다.

적용 대상