<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="HttpModuleTester" %>
HttpModuleTester
File: Default.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class HttpModuleTester : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
HttpContext myHttpContext = HttpContext.Current;
HttpApplication myHttpApplication = myHttpContext.ApplicationInstance;
HttpModuleCollection myHttpModuleCollection = myHttpApplication.Modules;
for (int index=0; index < myHttpModuleCollection.Count; index++)
{
IHttpModule module = myHttpModuleCollection.Get(index);
Response.Write("Module = " + module.ToString() + "
");
}
string httpModuleName = myHttpModuleCollection.GetKey(1);
Response.Write("The name of the HttpModule object at index 1" + " is " + "'" + httpModuleName + "'." + "
");
string[] allModules = myHttpModuleCollection.AllKeys;
Response.Write("The HttpModule objects contained in the HttpModuleCollection are:
");
for (int i = 0; i < allModules.Length; i++)
Response.Write("Module " + i + " : " + allModules[i] + "
");
}
}