Dismiss() public method

public Dismiss ( ) : void
return void
Ejemplo n.º 1
0
        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;
             }
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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
        }
Ejemplo n.º 4
0
        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;
            }
        }
Ejemplo n.º 5
0
 //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();
     }
 }
 private void ErrorLog_Filtering(object sender, ExceptionFilterEventArgs e)
 {
     if (e.Exception is System.Threading.ThreadAbortException)
     {
         e.Dismiss();
     }
 }
 void ErrorLog_Filtering(object sender, ExceptionFilterEventArgs e)
 {
     if (e.Exception.GetBaseException() is HttpException && ((HttpException)e.Exception.GetBaseException()).GetHttpCode() == 404)
     {
         e.Dismiss();
     }
 }
Ejemplo n.º 8
0
 public void ErrorMail_Filtering(object sender, ExceptionFilterEventArgs e)
 {
     var httpException = e.Exception as HttpException;
     if (httpException != null && httpException.GetHttpCode() == 404 || Debugger.IsAttached)
     {
         e.Dismiss();
     }
 }
Ejemplo n.º 9
0
 public void ErrorMail_Filtering(object sender, ExceptionFilterEventArgs e)
 {
     var httpException = e.Exception as JavaScriptException;
     if (httpException != null)
     {
         e.Dismiss();
     }
 }
Ejemplo n.º 10
0
 // 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();
     }
 }
Ejemplo n.º 11
0
        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();
        }
 // 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();
     }
    // Response.Redirect(@"/Error/Trouble");
 }
Ejemplo n.º 13
0
 // 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();
 }
Ejemplo n.º 14
0
        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();
        }
Ejemplo n.º 15
0
 //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;
             }
         }
     }
 }
        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();
            }
        }
Ejemplo n.º 17
0
        private void Filter(ExceptionFilterEventArgs e)
        {
            var ex = e.Exception.GetBaseException();
            var httpex = ex as HttpException;

            if (httpex != null)
            {
                if (httpex.GetHttpCode() == 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();
        }
Ejemplo n.º 18
0
 void ErrorLog_Filtering(object sender, ExceptionFilterEventArgs e)
 {
     if (e.Exception.GetBaseException() is HttpRequestValidationException)
         e.Dismiss();
 }
Ejemplo n.º 19
0
        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;
            }
        }
Ejemplo n.º 20
0
 void MyErrorMailModule_Filtering(object sender, ExceptionFilterEventArgs args)
 {
     var httpException = args.Exception.GetBaseException() as HttpException;
     if (httpException != null && httpException.GetHttpCode() == 404)
         args.Dismiss();
 }
Ejemplo n.º 21
0
        ///// <summary>
        ///// Customizes the outgoing ELMAH mail.
        ///// </summary>
        ///// <param name="sender"></param>
        ///// <param name="e"></param>
        //void ErrorMail_Mailing(object sender, ErrorMailEventArgs e)
        //{
        //    try
        //    {
        //        //if (e.Error.Exception is ApplicationException || (e.Error.Exception is HttpUnhandledException && e.Error.Exception.InnerException != null && e.Error.Exception.InnerException is ApplicationException))
        //        {
        //            //e.Mail.Priority = System.Net.Mail.MailPriority.High;
        //            //e.Mail.Subject = "iLoop Web API Exception";
        //            e.Mail.Sender = new MailAddress(e.Mail.Sender.Address, "iLoop Support");
        //        }
        //    }
        //    catch (Exception)
        //    {
        //    }
        //}

        /// <summary>
        /// Filters the outgoing ELMAH mail to bypass mail sending for certain scenarios.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void ErrorMail_Filtering(object sender, ExceptionFilterEventArgs e)
        {
            try
            {
                if (e.Exception.GetBaseException() is SessionException
                    || e.Exception.GetBaseException() is HttpException
                    || e.Exception.GetBaseException() is WebException
                     || !IsWebApiRequest()
                    || IsLocal()
                    )
                    e.Dismiss();
            }
            catch (Exception)
            {
            }
        }
Ejemplo n.º 22
0
 protected void ErrorLog_Filtering(object sender, ExceptionFilterEventArgs e)
 {
     if (e.Exception.GetBaseException().GetType() != typeof(HttpResponseException))
         e.Dismiss();
 }
Ejemplo n.º 23
0
        void Filter(ExceptionFilterEventArgs args)
        {
            HttpContext context = (HttpContext)args.Context;

            // exclude crawlers
            if (context.Request.UserAgent != null)
            {

                if (Regex.IsMatch(context.Request.UserAgent, @"bingbot"))
                {
                    args.Dismiss();
                    return;
                }
            }

            if (args.Exception.GetBaseException() is HttpException)
            {
                HttpException ex = (HttpException)args.Exception.GetBaseException();
                if (ex.GetHttpCode() == 404)
                {
                    args.Dismiss();
                    return;
                }
            }
        }
Ejemplo n.º 24
0
        // 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();
            }
            //            if (e.Exception.Source != "CATCH RAISED")
            //            {
            //                Response.Redirect(@"/Error/Trouble"); //...nothing seems to get to error page anyway
            //            }
        }
Ejemplo n.º 25
0
 // ReSharper restore InconsistentNaming
 // ReSharper disable InconsistentNaming
 protected void ErrorLog_Filtering(object sender, ExceptionFilterEventArgs args)
 {
     var httpEx = args.Exception.GetBaseException() as HttpException;
     if(httpEx != null)
     {
         int code = httpEx.GetHttpCode();
         if(code == 404)
         {
             args.Dismiss();
         }
     }
 }
Ejemplo n.º 26
0
 void ErrorLog_Filtering(object sender, ExceptionFilterEventArgs e)
 {
     if (e.Exception.Message.StartsWith(@"File does not exist"))
         e.Dismiss();
 }
Ejemplo n.º 27
0
        private static void FilterOutSensitiveFormData(ExceptionFilterEventArgs e)
        {
            var ctx = e.Context as HttpContext;
            if (ctx == null)
                return;

            var sensitiveFormKeys = new[] { "creditcard", "ccv", "cvv", "cardnumber", "cardcode", "password", "account", "routing" };

            var sensitiveFormData = ctx.Request.Form.AllKeys.Where(
                k => sensitiveFormKeys.Contains(k.ToLower(), StringComparer.OrdinalIgnoreCase)).ToList();

            if (!sensitiveFormData.Any() || Util.IsDebug())
                return;

            var error = new Error(e.Exception, ctx);
            sensitiveFormData.ForEach(k => error.Form.Set(k, "*****"));
            ErrorLog.GetDefault(ctx).Log(error);
            e.Dismiss();
        }
Ejemplo n.º 28
0
 public void ErrorLog_Filtering(object sender, ExceptionFilterEventArgs e)
 {
     // don't log file not found exception to elmah
     if (e.Exception.GetBaseException() is FileNotFoundException)
         e.Dismiss();
 }
Ejemplo n.º 29
0
 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();
     }
 }
Ejemplo n.º 30
0
        //ReSharper restore InconsistentNaming
        // ReSharper disable InconsistentNaming
        protected void ErrorMail_Filtering(object sender, ExceptionFilterEventArgs args)
        {
            //TODO: Consider using filter configs
            Exception exception = args.Exception;
            bool include = (
                           	exception is CriticalException ||
                           	exception is AmazonS3Exception ||
                           	exception is AmazonSimpleEmailServiceException
                           	||
                           	(
                           		exception is AggregateException &&
                           		exception.ToString().Contains("Amazon")
                           	)
                           );

            if (!include)
            {
                args.Dismiss();
            }
        }