protected override void OnActionExecuted(ActionExecutedContext filterContext) { if (Request.UserHostAddress != "::1") { var c = filterContext.RouteData.Values["controller"]; var a = filterContext.RouteData.Values["action"]; var requestLogs = new TempRequestLog { CreatedDate = DateTime.Now, RequestUrl = "/" + c + "/" + a, PersonId = Accesses.PersonId, IpAddress = Request.UserHostAddress, }; _logService.InsertTempRequestLog(requestLogs); _uow.SaveChanges(); } if (filterContext.Exception != null) { var exceptionLog = new ExceptionLog { StackTrace = filterContext.Exception.InnerException == null ? filterContext.Exception.StackTrace : filterContext.Exception.InnerException.StackTrace, Message = filterContext.Exception.InnerException == null ? filterContext.Exception.Message : filterContext.Exception.InnerException.Message, ExceptionUrl = filterContext.HttpContext.Request.RawUrl.ToString(), IpAdress = Request.UserHostAddress ?? "0", HResult = filterContext.Exception.HResult, BrowserInfo = "Name : " + Request.Browser.Browser + ", Type : " + Request.Browser.Type + ", Version : " + Request.Browser.Version, CreatedBy = Accesses.PersonId, CreatedDate = DateTime.Now, ErrorCount = 1, }; _logService.InsertExceptionLog(exceptionLog); _uow.SaveChanges(); filterContext.HttpContext.Response.Clear(); filterContext.HttpContext.Response.Status = "500 Internal Server Error"; filterContext.Result = AjaxMessage("Hata", "Hata No :" + filterContext.Exception.HResult + "<br/> Hata Mesajı : " + (filterContext.Exception.InnerException == null ? filterContext.Exception.Message : filterContext.Exception.InnerException.Message), MessageTypes.danger); filterContext.ExceptionHandled = true; } }
public void InsertTempRequestLog(TempRequestLog entity) { _tempRequestLogRepository.Insert(entity); }