November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
It seems my custom Application_Error is called before Episerver's Global_Error, so I thought I would try and clear the error to prevent Global_Error from catching it. I tried all combinations of ClearError but with no success. Somehow Global_Error still found it and logged it ("1.2.5 Unhandled exception in ASP.NET"). Finally I tried to forcefully set HttpContext.Current = null when my condition was true, and this seemed to stop Episerver from catching my error. But it does not really seem like the right thing to do :-/
In fact i have the same problem, can someone tell me or there is a fix for this? The main problem is that due to this problem we also get a lot of false-positives in our New Relic monitoring because the level of logging for this is: Error.
Hi,
When you call ClearError() what you get back from HttpContext.AllErrors?
At the moment the only way to "shut up" EPiServer logging on Error severity for these cases would be to either get HttpContext.Error property to return null or set HttpContext to null (as you already did it).
For anyone interested, this is the code that we use to intercept 404:s and turn them into warnings
protected void Application_Error(Object sender, EventArgs e) { var ex = Server.GetLastError().GetBaseException(); if (ex is HttpException && ((HttpException)ex).GetHttpCode() == 404) { // This is the only working approach we've found to prevent Episerver from grabbing the error in Global_Error and logging it. HttpContext.Current = null; Logger.WarnFormat("Requested url '{0}' not found", Request.Url); Response.StatusCode = 404; } }
We've recently noticed on our live site that we get a lot of errors in the log related to "The controller for path '/something/else' was not found or does not implement IController". Many times this seems to be hacker attempts, trying to forecfully access wordpress admin urls or other similar cgi-related urls. Thing is, whenever this happens, an error is caught in Episerver.Global which is logged as an Error. If you have SCOM monitoring these kinds of errors will eventually flood your system.
What I would like to do is to catch this very error and adjust it to be a warning. How can I intercept an error in my custom global implementation before Episerver gets hold of it?