Using System. Configuration;
Using System. Linq;
Using System. Web;
Using System. Web. Security;
Using System. Web. UI;
Using System. Web. UI. HtmlControls;
Using System. Web. UI. WebControls;
Using System. Web. UI. WebControls. WebParts;
Using System. Xml. Linq;
/// <Summary>
/// Summary of Class1
Namespace MyModule
{
Public class MyModule: IHttpModule
{
/// <Summary>
/// Initialize and add two events to the Application.
/// </Summary>
/// <Param name = "application"> </param>
Public void Init (HttpApplication application)
{
Application. BeginRequest + = (new
EventHandler (this. Application_BeginRequest ));
Application. EndRequest + = (new
EventHandler (this. Application_EndRequest ));
}
/// Here it must be equivalent to converting Response. It cannot be used directly here. I don't know why.
/// Write this statement to determine the permission.
Private void Application_BeginRequest (Object source, EventArgs e)
{
HttpApplication Application = (HttpApplication) source;
HttpResponse ResponseOK = Application. Context. Response;
ResponseOK. Write ("
}
Private void Application_EndRequest (Object source, EventArgs e)
{
HttpApplication Application = (HttpApplication) source;
HttpResponse ResponseOK = Application. Context. Response;
ResponseOK. Write ("}
Public void Dispose (){}
}
}
//// The following content in Web. Config
<HttpModules>
<Add name = "ScriptModule" type = "System. Web. Handlers. ScriptModule,
System. Web. Extensions, Version = 3.5.0.0, Culture = neutral,
PublicKeyToken = 31BF3856AD364E35 "/>
<Add name = "MyModule" type = "MyModule. MyModule"/>
<! -- <Add name = "MyModule" type = ""/> -->
</HttpModules>
/// This method is called every execution page.