using System; using System.Web; namespace cnblogs { /// <summary> /// Summary description for DownloadCountModule /// </summary> public class DownloadCounterModule : IHttpModule { public DownloadCounterModule() { } #region IHttpModule Members public void Dispose() { } public void Init(HttpApplication context) { context.PreSendRequestContent += new EventHandler(context_PreRequestHandlerExecute); } void context_PreRequestHandlerExecute(object sender, EventArgs e) { HttpApplication app = (HttpApplication)sender; HttpContext context = app.Context; string url = context.Request.RawUrl; //文件下载统计代码 } #endregion } }