c# - Catching an exception and clearing it before ELMAH gets it -


i have problem have exception being thrown capturing in global.asax. part of exception handling redirect user specific page because of exception.

i have elmah error handling email module plugged in. not want receive emails exception. don't want add type of exception elmahs ignore list, in case want granular work around exception (i.e., if matches properties, happens on pages)

i want to:

  • write application_onerror redirects user page (i know how part, more procedure i've left here)
  • in application_onerror stop elmah receiving error after i've caught it

i calling server.clearerror() inside app_onerror method, still receiving these emails.

as per elmah documentation

i put leave application_onerror method in global.asax add following global methods:

void errorlog_filtering(object sender, exceptionfiltereventargs args) {     filter(args); }  void errormail_filtering(object sender, exceptionfiltereventargs args) {     filter(args); }  void filter(exceptionfiltereventargs args) {     if (args.exception.getbaseexception() httprequestvalidationexception)     {         args.dismiss();     } } 

what dismiss elmah exception if type matches want - in case httprequestvalidationexception.

the errormail_filtering method required if have error mail filter turned on - do.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -