Created
March 12, 2014 14:50
-
-
Save abhishekluv/9508505 to your computer and use it in GitHub Desktop.
Custom HTTP Module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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