在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
1.过滤器代码 public class PageFilter : IHttpModule { public String ModuleName { get { return "PageFilter"; } } public void Dispose() { } //在 Init 方法中注册HttpApplication // 通过委托方式注册事件 public void Init(HttpApplication application) { application.BeginRequest += Application_BeginRequest; application.Error += Application_Error; application.AcquireRequestState += new EventHandler(Application_AcquireRequestState); application.EndRequest += Application_EndRequest; } private void Application_BeginRequest(object sender, EventArgs e) { HttpApplication application = (HttpApplication)sender; HttpContext context = application.Context; HttpSessionState session = context.Session; HttpRequest request = context.Request; HttpResponse response = context.Response; String contextPath = request.ApplicationPath; var rawUrl = request.RawUrl; if (rawUrl.Contains("/admin/Sys/SysDictTypeEdit.aspx") && rawUrl.Contains("_method=Save")) { System.Diagnostics.Debug.WriteLine("begin request"); } } private void Application_Error(object sender, EventArgs e) { HttpApplication application = (HttpApplication)sender; HttpContext context = application.Context; HttpSessionState session = context.Session; HttpRequest request = context.Request; HttpResponse response = context.Response; String contextPath = request.ApplicationPath; var rawUrl = request.RawUrl; if (rawUrl.Contains("/admin/Sys/SysDictTypeEdit.aspx") && rawUrl.Contains("_method=Save")) { System.Diagnostics.Debug.WriteLine("error"); } } private void Application_EndRequest(object sender, EventArgs e) { HttpApplication application = (HttpApplication)sender; HttpContext context = application.Context; HttpSessionState session = context.Session; HttpRequest request = context.Request; HttpResponse response = context.Response; String contextPath = request.ApplicationPath; var rawUrl = request.RawUrl; if (rawUrl.Contains("/admin/Sys/SysDictTypeEdit.aspx") && rawUrl.Contains("_method=Save")) { System.Diagnostics.Debug.WriteLine("end request"); } } private void Application_AcquireRequestState(Object source, EventArgs e) { try { HttpApplication application = (HttpApplication)source; HttpContext context = application.Context; HttpSessionState session = context.Session; HttpRequest request = context.Request; HttpResponse response = context.Response; String contextPath = request.ApplicationPath; if (application.Context.Handler is System.Web.UI.TemplateControl) { var path = ((System.Web.UI.TemplateControl)application.Context.Handler).AppRelativeVirtualPath; if (path == "~/admin/Sys/SysDictTypeEdit.aspx" && request["_method"] == "Save") { Action action = () => System.Diagnostics.Debug.WriteLine("Save777");
|
请发表评论