public override void OnException(HttpActionExecutedContext ctx) { if (!IgnoreExceptions.Contains(ctx.Exception.GetType())) { var statusCode = GetStatus(ctx.Exception.GetType()); var error = new HttpError(ctx.Exception, IncludeErrorDetails(ctx)); var req = ctx.Request; var exLog = ctx.Exception.LogException(e => { e.ActionName = ctx.ActionContext.ActionDescriptor.ActionName; e.ControllerName = ctx.ActionContext.ActionDescriptor.ControllerDescriptor.ControllerName; e.UserAgent = req.Headers.UserAgent.ToString(); e.RequestUrl = req.RequestUri.ToString(); e.UrlReferer = req.Headers.Referrer?.ToString(); e.UserHostAddress = GetClientIp(req); e.UserHostName = GetClientName(req); e.QueryString = ExceptionEntity.Dump(req.RequestUri.ParseQueryString()); e.Form = (string)(req.Properties.ContainsKey(SignumAuthenticationAndProfilerAttribute.SavedRequestKey) ? req.Properties[SignumAuthenticationAndProfilerAttribute.SavedRequestKey] : null); e.Session = GetSession(req); }); error["ExceptionID"] = exLog.Id.ToString(); ctx.Response = ctx.Request.CreateResponse <HttpError>(statusCode, error); } base.OnException(ctx); }