本文整理汇总了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;
}
}
示例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);
}
示例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
}
示例4: ErrorLog_Filtering
void ErrorLog_Filtering(object sender, ExceptionFilterEventArgs e)
{
if (e.Exception.GetBaseException() is HttpException && ((HttpException)e.Exception.GetBaseException()).GetHttpCode() == 404)
{
e.Dismiss();
}
}
示例5: ErrorLog_Filtering
private void ErrorLog_Filtering(object sender, ExceptionFilterEventArgs e)
{
if (e.Exception is System.Threading.ThreadAbortException)
{
e.Dismiss();
}
}
示例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();
}
}
示例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();
}
}
示例8: ErrorMail_Filtering
public void ErrorMail_Filtering(object sender, ExceptionFilterEventArgs e)
{
var httpException = e.Exception as JavaScriptException;
if (httpException != null)
{
e.Dismiss();
}
}
示例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();
}
}
示例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();
}
示例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();
}
示例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();
}
示例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;
}
}
}
}
示例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;
}
}