本文整理汇总了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);
}
示例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;
}
}
示例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();
}
}
示例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
public void ErrorMail_Filtering(object sender, ExceptionFilterEventArgs e)
{
var httpException = e.Exception as HttpException;
if (httpException != null && httpException.GetHttpCode() == 404 || Debugger.IsAttached)
{
e.Dismiss();
}
}
示例7: ErrorMail_Filtering
public void ErrorMail_Filtering(object sender, ExceptionFilterEventArgs e)
{
var httpException = e.Exception as JavaScriptException;
if (httpException != null)
{
e.Dismiss();
}
}
示例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();
}
}
示例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();
}
}
示例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 httpException = e.Exception as HttpException;
if (httpException != null && httpException.GetHttpCode() == 404)
{
e.Dismiss();
}
#if DEBUG
e.Dismiss();
#endif
}
示例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);
}
}
}
示例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();
}
示例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();
//}
}
示例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();
}