다음을 통해 공유


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>

속성

Name Description
AllKeys

에 있는 모든 키(모듈 이름)를 포함하는 문자열 배열을 HttpModuleCollection가져옵니다.

Count

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

(다음에서 상속됨 NameObjectCollectionBase)
IsReadOnly

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

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

에서 IHttpModule 지정된 숫자 인덱스가 있는 개체를 HttpModuleCollection가져옵니다.

Item[String]

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

Keys

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

(다음에서 상속됨 NameObjectCollectionBase)

메서드

Name Description
BaseAdd(String, Object)

지정된 키와 값이 있는 항목을 인스턴스에 NameObjectCollectionBase 추가합니다.

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

인스턴스에서 NameObjectCollectionBase 모든 항목을 제거합니다.

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

인스턴스의 지정된 인덱스에서 항목의 NameObjectCollectionBase 값을 가져옵니다.

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

인스턴스에서 NameObjectCollectionBase 지정된 키를 가진 첫 번째 항목의 값을 가져옵니다.

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

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

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

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

(다음에서 상속됨 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 구현하고 인스턴스를 serialize하는 데 필요한 데이터를 반환합니다 NameObjectCollectionBase .

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

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

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

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

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

역직렬화가 ISerializable 완료되면 인터페이스를 구현하고 역직렬화 이벤트를 발생합니다.

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

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

(다음에서 상속됨 Object)

명시적 인터페이스 구현

Name Description
ICollection.CopyTo(Array, Int32)

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

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

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

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

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

(다음에서 상속됨 NameObjectCollectionBase)

확장명 메서드

Name Description
AsParallel(IEnumerable)

쿼리의 병렬 처리를 사용하도록 설정합니다.

AsQueryable(IEnumerable)

IEnumerable IQueryable변환합니다.

Cast<TResult>(IEnumerable)

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

OfType<TResult>(IEnumerable)

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

적용 대상