示例#1
0
        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
            });
        }
示例#2
0
        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);
        }
示例#3
0
 public ActionResult ShowException(MvcExceptionInfo exception)
 {
     return(SetException(exception));
 }