Skip to content

Instantly share code, notes, and snippets.

@abhishekluv
Created March 12, 2014 14:50
Show Gist options
  • Save abhishekluv/9508505 to your computer and use it in GitHub Desktop.
Save abhishekluv/9508505 to your computer and use it in GitHub Desktop.
Custom HTTP Module
using System;
using System.Web;
using System.Diagnostics;
public class LogModule : IHttpModule {
public LogModule(){
//constructor
}
public string ModuleName {
get { return "LogModule"; }
}
public void Dispose(){
}
public void Init(HttpApplication context){
// registering the events inside the Init method
context.BeginRequest +=
(new EventHandler(this.Application_BeginRequest));
context.EndRequest +=
(new EventHandler(this.Application_EndRequest));
}
public void Application_BeginRequest(Object source, EventArgs e){
// logging code
// Begin request logging
}
public void Application_EndRequest(Object source, EventArgs e){
// logging code
// End request logging
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment