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


C# ExceptionFilterEventArgs.Dismiss方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例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

 //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

示例7: 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

示例8: 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

示例9: 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

示例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 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

示例12: 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

示例13: 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

示例14: 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

示例15: 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


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