private ActionResult SetException(MvcExceptionInfo exception) { this.HttpContext.Response.Clear(); this.HttpContext.Response.StatusCode = exception.StatusCode.Value; this.HttpContext.Response.TrySkipIisCustomErrors = true; return(new JsonResult { Data = new { Message = exception.Message, Details = exception.Details, IsRTL = exception.IsRTL } , RecursionLimit = 3, JsonRequestBehavior = System.Web.Mvc.JsonRequestBehavior.AllowGet }); }
protected override void OnException(System.Web.Mvc.ExceptionContext filterContext) { //Core.Cmn.AppBase.TraceViewer.Failure(filterContext.Exception.InnerException + filterContext.Exception.StackTrace + filterContext.Exception.Message); MvcExceptionInfo excepInfo = new MvcExceptionInfo(filterContext.Exception, false); //if (!this.HttpContext.User.Identity.Name.ToLower().Equals("admin")) //{ // var constantService = AppBase.DependencyInjectionManager.Resolve<Service.IConstantService>(); // var applicationFaildMsg = string.Empty; // constantService.TryGetValue<string>("ApplicationFaild", out applicationFaildMsg); // excepInfo.Message = applicationFaildMsg/*Core.Resources.ExceptionMessage.ApplicationFaild*/; // excepInfo.Details = ""; // excepInfo.IsRTL = true; //} filterContext.Result = SetException(excepInfo); filterContext.ExceptionHandled = true; _logService.Handle(filterContext.Exception, excepInfo.Message); }
public ActionResult ShowException(MvcExceptionInfo exception) { return(SetException(exception)); }