SyncModule.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using System;
  2. using System.Collections;
  3. using System.Web;
  4. namespace TestMonoWeb
  5. {
  6. public class SyncModule : IHttpModule {
  7. public String ModuleName {
  8. get { return "HelloWorldModule"; }
  9. }
  10. //In the Init function, register for HttpApplication
  11. //events by adding your handlers.
  12. public void Init(HttpApplication application) {
  13. application.BeginRequest += (new EventHandler(this.Application_BeginRequest));
  14. application.EndRequest += (new EventHandler(this.Application_EndRequest));
  15. }
  16. //Your BeginRequest event handler.
  17. private void Application_BeginRequest(Object source, EventArgs e) {
  18. HttpApplication application = (HttpApplication)source;
  19. HttpContext context = application.Context;
  20. context.Response.Write("SyncModule.Application_BeginRequest()<br>\n");
  21. }
  22. //Your EndRequest event handler.
  23. private void Application_EndRequest(Object source, EventArgs e) {
  24. HttpApplication application = (HttpApplication)source;
  25. HttpContext context = application.Context;
  26. context.Response.Write("SyncModule.Application_EndRequest()<br>\n");
  27. }
  28. public void Dispose() {
  29. }
  30. }
  31. }