HttpModuleCollection.AllKeys 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
HttpModuleCollection의 키(모듈 이름)가 모두 들어 있는 문자열 배열을 가져옵니다.
public:
property cli::array <System::String ^> ^ AllKeys { cli::array <System::String ^> ^ get(); };
public string[] AllKeys { get; }
member this.AllKeys : string[]
Public ReadOnly Property AllKeys As String()
속성 값
- String[]
모듈 이름으로 이루어진 배열입니다.
예제
다음 코드 예제는 AllKeys 속성 및 GetKey 및 CopyTo 의 메서드는 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>