• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Elmah.ExceptionFilterEventArgs类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: OnErrorModuleFiltering

        protected virtual void OnErrorModuleFiltering(object sender, ExceptionFilterEventArgs args)
        {
            if (args == null)
                throw new ArgumentNullException("args");
            
            if (args.Exception == null)
                throw new ArgumentException(null, "args");

            try
            {
                if (Assertion.Test(new AssertionHelperContext(sender, args.Exception, args.Context)))
                    args.Dismiss();
            }
            catch (Exception e)
            {
                Trace.WriteLine(e);
                throw;
            }
        }
开发者ID:elmah,项目名称:Elmah,代码行数:19,代码来源:ErrorFilterModule.cs


示例17: LogException

        protected override void LogException(Exception e, HttpContext context)
        {
            if (e == null)
                throw new ArgumentNullException("e");

            var args = new ExceptionFilterEventArgs(e, context);
            OnFiltering(args);

            if (args.Dismissed)
                return;

            try
            {
                e.SendToAirbrake();
            }
            catch (Exception localException)
            {
                Trace.WriteLine(localException);
            }
        }
开发者ID:digbyswift,项目名称:Digbyswift.ElmahModules,代码行数:20,代码来源:AirbrakeErrorLogModule.cs


示例18: FilterException

        private static void FilterException(object sender, ExceptionFilterEventArgs args)
        {
            var httpContext = args.Context as HttpContext;
            var error = new Error(args.Exception, httpContext.ApplicationInstance.Context);

            var sensitiveFormDataNames = httpContext.Items[Constants.HttpContextItemsKey] as IEnumerable<string>;
            if (sensitiveFormDataNames == null)
            {
                return;
            }

            var sensitiveFormData = httpContext.Request.Form.AllKeys
                .Where(key => sensitiveFormDataNames.Contains(key.ToLowerInvariant()))
                .ToList();
            if (sensitiveFormData.Any())
            {
                sensitiveFormData.ForEach(k => error.Form.Set(k, Config.SensitiveDataReplacementText));
                ErrorLog.GetDefault(httpContext).Log(error);
                args.Dismiss();
            }
        }
开发者ID:joshuahealy,项目名称:ElmahSensitiveDataFiltering,代码行数:21,代码来源:ElmahSensitiveDataFilterEventHandler.cs


示例19: FilterError

 //Dimiss 404 errors for ELMAH
 protected void FilterError(ExceptionFilterEventArgs e)
 {
     if (e.Exception.GetBaseException() is HttpException)
     {
         HttpException ex = (HttpException)e.Exception.GetBaseException();
         if (ex.Message.Contains("A potentially dangerous Request.Path value was detected from the client"))
             e.Dismiss();
         else
         {
             switch (ex.GetHttpCode())
             {
                 case 404:
                     e.Dismiss();
                     break;
                 case 410:
                     e.Dismiss();
                     break;
                 case 406:
                     e.Dismiss();
                     break;
             }
         }
     }
 }
开发者ID:ansarbek,项目名称:thewall9-CMS,代码行数:25,代码来源:Thewall9Application.cs


示例20: ErrorMail_Filtering

 protected void ErrorMail_Filtering(object sender, ExceptionFilterEventArgs args)
 {
     ElmahFilter.FilterSensitiveData(args);
 }
开发者ID:EnvironmentAgency,项目名称:prsd-weee,代码行数:4,代码来源:Global.asax.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Eluant.LuaFunction类代码示例发布时间:2022-05-24
下一篇:
C# Common.SigmaResultType类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap