当前位置: 首页>>代码示例>>C#>>正文


C# Elmah.ExceptionFilterEventArgs类代码示例

本文整理汇总了C#中Elmah.ExceptionFilterEventArgs的典型用法代码示例。如果您正苦于以下问题:C# ExceptionFilterEventArgs类的具体用法?C# ExceptionFilterEventArgs怎么用?C# ExceptionFilterEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ExceptionFilterEventArgs类属于Elmah命名空间,在下文中一共展示了ExceptionFilterEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ErrorMail_Filtering

        void ErrorMail_Filtering(object sender, ExceptionFilterEventArgs args)
        {
            if (args.Exception is ArgumentException)
            {
                args.Dismiss();
                return;
            }

            var context = (HttpContext)args.Context;
            if (context != null && context.Request.UserAgent != null)
            {

                if (context.Request.UserAgent == "Test Certificate Info" && args.Exception is System.Web.HttpException)
                {
                    args.Dismiss();
                    return;
                }

                if (context.Request.UserAgent.Contains("ZmEu"))
                {
                    args.Dismiss();
                    return;
                }

                if (context.Request.UserAgent.Contains("Googlebot"))
                {
                    args.Dismiss();
                    return;
                }
            }

            Filter(args);
        }
开发者ID:johnnyoshika,项目名称:elmah-example,代码行数:33,代码来源:Global.asax.cs

示例2: Filter

        private void Filter(ExceptionFilterEventArgs e)
        {
            var exception = e.Exception.GetBaseException();
             var httpException = exception as HttpException;

             if (HttpContext.Current.Request.IsLocal)
             {
            e.Dismiss();
            return;
             }

             // User hit stop/esc while the page was posting back
             if (exception is HttpException && exception.Message.ToLower().Contains("the client disconnected.") ||
             exception.Message.ToLower().Contains("the remote host closed the connection."))
             {
            e.Dismiss();
            return;
             }

             // User hit stop while posting back and thew this error
             if (exception is ViewStateException && exception.Message.ToLower().Contains("invalid viewstate. client ip:"))
             {
            e.Dismiss();
            return;
             }
        }
开发者ID:psychotiic,项目名称:speedyspots,代码行数:26,代码来源:Global.asax.cs

示例3: ErrorMail_Filtering

 //private static IWindsorContainer InitializeServiceLocator()
 //{
 //    //IWindsorContainer container = new WindsorContainer();
 //    //ControllerBuilder.Current.SetControllerFactory(new WindsorControllerFactory(container));
 //    //container.RegisterControllers(typeof(HomeController).Assembly);
 //    //ComponentRegistrar.AddComponentsTo(container);
 //    //ServiceLocator.SetLocatorProvider(() => new WindsorServiceLocator(container));
 //    //return container;
 //}
 /// <summary>
 /// ELMAH filtering for the mail log
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void ErrorMail_Filtering(object sender, ExceptionFilterEventArgs e)
 {
     if (e.Exception.GetBaseException() is HttpException)
     {
         e.Dismiss();
     }
 }
开发者ID:ucdavis,项目名称:Commencement,代码行数:21,代码来源:Global.asax.cs

示例4: ErrorLog_Filtering

 void ErrorLog_Filtering(object sender, ExceptionFilterEventArgs e)
 {
     if (e.Exception.GetBaseException() is HttpException && ((HttpException)e.Exception.GetBaseException()).GetHttpCode() == 404)
     {
         e.Dismiss();
     }
 }
开发者ID:Draupner,项目名称:DraupnerGeneratedSample,代码行数:7,代码来源:Global.asax.cs

示例5: ErrorLog_Filtering

 private void ErrorLog_Filtering(object sender, ExceptionFilterEventArgs e)
 {
     if (e.Exception is System.Threading.ThreadAbortException)
     {
         e.Dismiss();
     }
 }
开发者ID:cohs88,项目名称:ps-html5-line-of-business-apps,代码行数:7,代码来源:Global.asax.cs

示例6: ErrorMail_Filtering

 public void ErrorMail_Filtering(object sender, ExceptionFilterEventArgs e)
 {
     var httpException = e.Exception as HttpException;
     if (httpException != null && httpException.GetHttpCode() == 404 || Debugger.IsAttached)
     {
         e.Dismiss();
     }
 }
开发者ID:dwick,项目名称:Me,代码行数:8,代码来源:Global.asax.cs

示例7: ErrorMail_Filtering

 public void ErrorMail_Filtering(object sender, ExceptionFilterEventArgs e)
 {
     var httpException = e.Exception as JavaScriptException;
     if (httpException != null)
     {
         e.Dismiss();
     }
 }
开发者ID:NonameProject,项目名称:Noname,代码行数:8,代码来源:AbitcareerApplication.cs

示例8: FilterError404

 // Dismiss 404 errors for ELMAH
 private void FilterError404(ExceptionFilterEventArgs e)
 {
     if (e.Exception.GetBaseException() is HttpException)
     {
         HttpException ex = (HttpException)e.Exception.GetBaseException();
         if (ex.GetHttpCode() == 404)
             e.Dismiss();
     }
 }
开发者ID:iPie,项目名称:WebPresentations,代码行数:10,代码来源:Global.asax.cs

示例9: Filter404Errors

 private void Filter404Errors(ExceptionFilterEventArgs args)
 {
     if (args.Exception.GetBaseException() is HttpException)
     {
         var httpException = args.Exception.GetBaseException() as HttpException;
         if (httpException != null && httpException.GetHttpCode() == 404)
             args.Dismiss();
     }
 }
开发者ID:OrenTiger,项目名称:my-personal-blog,代码行数:9,代码来源:Global.asax.cs

示例10: FilterError404

 // Dismiss 404 errors for ELMAH
 private static void FilterError404(ExceptionFilterEventArgs e)
 {
     if (!(e.Exception.GetBaseException() is HttpException))
     {
         return;
     }
     var ex = (HttpException)e.Exception.GetBaseException();
     if (ex.GetHttpCode() == 404)
         e.Dismiss();
 }
开发者ID:windforze,项目名称:Bootstrap,代码行数:11,代码来源:Global.asax.cs

示例11: ErrorMail_Filtering

        public void ErrorMail_Filtering(object sender, ExceptionFilterEventArgs e)
        {
            var httpException = e.Exception as HttpException;
            if (httpException != null && httpException.GetHttpCode() == 404)
            {
                e.Dismiss();
            }

            #if DEBUG
                e.Dismiss();
            #endif
        }
开发者ID:sholchi,项目名称:Mvc3ErrorHandling,代码行数:12,代码来源:Global.asax.cs

示例12: FilterSensitiveData

 /// <summary>
 /// This method checks the HttpContext associated with the Exception for any sensitive
 /// data submitted in the form that should not be logged in plain text.
 /// If fields are found that match the names in the SensitiveFieldNames list, their values
 /// are replaced with **** before the error is logged.
 /// </summary>
 /// <param name="args"></param>
 internal static void FilterSensitiveData(ExceptionFilterEventArgs args)
 {
     if (args.Context != null)
     {
         HttpContext context = (HttpContext)args.Context;
         if (context.Request != null &&
             context.Request.Form != null &&
             context.Request.Form.AllKeys.Intersect(sensitiveFieldNames, StringComparer.InvariantCultureIgnoreCase).Any())
         {
             ReplaceSensitiveFormFields(args, context);
         }
     }
 }
开发者ID:EnvironmentAgency,项目名称:prsd-iws,代码行数:20,代码来源:ElmahFilter.cs

示例13: ReplaceSensitiveFormFields

        private static void ReplaceSensitiveFormFields(ExceptionFilterEventArgs args, HttpContext context)
        {
            var replacementError = new Error(args.Exception, (HttpContext)args.Context);

            foreach (var formField in context.Request.Form.AllKeys)
            {
                if (sensitiveFieldNames.Contains(formField, StringComparer.InvariantCultureIgnoreCase))
                {
                    replacementError.Form.Set(formField, "****");
                }
            }

            ErrorLog.GetDefault(HttpContext.Current).Log(replacementError);
            args.Dismiss();
        }
开发者ID:EnvironmentAgency,项目名称:prsd-iws,代码行数:15,代码来源:ElmahFilter.cs

示例14: ErrorLog_Filtering

        protected void ErrorLog_Filtering(object sender, ExceptionFilterEventArgs e)
        {
            // Cancels elmah logging for these conditions.

            //if (!Request.Url.ToString().ToLower().Contains(ConfigurationManager.AppSettings["klasresearchURL"], true) || Request.UserAgent.ToLower().Contains("bot", true) || Request.UserAgent.ToLower().Contains("spider", true) || Request.UserAgent.ToLower().Contains("crawler", true) || Request.UserAgent.ToLower().Contains("slurp", true) || Request.UserAgent.ToLower().Contains("ezooms", true))
            //{

            //    e.Dismiss();

            //}

            //if (Request.Url.ToString().ToLower().Contains("jw-icons.eot"))
            //{

            //    e.Dismiss();

            //}
        }
开发者ID:wvanderheide,项目名称:slnWalter,代码行数:18,代码来源:Global.asax.cs

示例15: ErrorMail_Filtering

        public void ErrorMail_Filtering(object sender, ExceptionFilterEventArgs e)
        {
            var ex = e.Exception.GetBaseException();
            var httpex = ex as HttpException;

            if (httpex != null)
            {
                var status = httpex.GetHttpCode();
                if (status == 400 || status == 404)
                    e.Dismiss();
                else if (httpex.Message.Contains("The remote host closed the connection"))
                    e.Dismiss();
                else if (httpex.Message.Contains("A potentially dangerous Request.Path value was detected from the client"))
                    e.Dismiss();
            }

            if (ex is FileNotFoundException || ex is HttpRequestValidationException)
                e.Dismiss();
        }
开发者ID:vanutama,项目名称:bvcms,代码行数:19,代码来源:Global.asax.cs


注:本文中的Elmah.ExceptionFilterEventArgs类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。