如何将我的httpmodules类与httplistener web服务
一起使用这是我的http模块代码:
using System;
using System.Web;
using System.Collections;
public class MyCustomHttpModule: IHttpModule
{
public String ModuleName
{
application.BeginRequest += (new EventHandler(this.Application_BeginRequest));
application.EndRequest += (new EventHandler(this.Application_EndRequest));
}
private void Application_BeginRequest(Object source, EventArgs e)
{
HttpApplication application = (HttpApplication)source;
HttpContext context = application.Context;
context.Response.Write("<h1>MyCustomHttpModule: Beginning of Request...</h1><br/>");
}
private void Application_EndRequest(Object source, EventArgs e)
{
HttpApplication application = (HttpApplication)source;
HttpContext context = application.Context;
context.Response.Write("<h1>MyCustomHttpModule: End of Request...</h1>");
}
public void Dispose()
{
}
}
httplistener代码如下:
using HttpListener = HttpServer.HttpListener;
public class Loader
{
static void Main(string[] args)
{
HttpListener listener = HttpListener.Create(IPAddress.Any, 8089);
DynamicModuleUtility.RegisterModule(typeof(FileWebDAVModule));
listener.Start(5);
Thread.Sleep(90000000);
}
}
如何使用httplistener服务调用我的httpmodule。 请指导我。