private bool IsServerLevelErrorCode(HttpErrorStatusCode statusCode) { if (statusCode == HttpErrorStatusCode.ConnectFailure) { return(true); } int status = (int)statusCode; return(status >= 500 && status < 600); }
protected override void OnException(ExceptionContext filterContext) { HttpErrorStatusCode statusCode = HttpErrorStatusCode.InternalServerError_500; HttpException httpException = filterContext.Exception as HttpException; if (httpException != null) { statusCode = (HttpErrorStatusCode)httpException.GetHttpCode(); } if (statusCode == HttpErrorStatusCode.NotFound_404) { ProxyRender proxyRender = Kooboo.CMS.Common.Runtime.EngineContext.Current.Resolve <ProxyRender>(); var actionResult = proxyRender.TryRemoteRequest(filterContext.Controller.ControllerContext); if (actionResult != null) { filterContext.Result = actionResult; filterContext.ExceptionHandled = true; } } if (filterContext.ExceptionHandled == false) { if (Site != null) { var customError = Services.ServiceFactory.CustomErrorManager.Get(Site, statusCode.ToString()); if (customError != null) { var errorUrl = customError.RedirectUrl; if (!string.IsNullOrEmpty(errorUrl) && !errorUrl.TrimStart('~').TrimStart('/').TrimEnd('/').EqualsOrNullEmpty(this.Request.AppRelativeCurrentExecutionFilePath.TrimStart('~').TrimStart('/').TrimEnd('/'), StringComparison.OrdinalIgnoreCase)) { filterContext.Result = RedirectHelper.CreateRedirectResult(Site, FrontHttpRequest.RequestChannel, errorUrl, Request.RawUrl, (int)statusCode, customError.RedirectType, customError.ShowErrorPath); filterContext.ExceptionHandled = true; } } } else { if (statusCode == HttpErrorStatusCode.NotFound_404) { filterContext.Result = RedirectTo404(); filterContext.ExceptionHandled = true; } } Kooboo.HealthMonitoring.Log.LogException(filterContext.Exception); } base.OnException(filterContext); }
public HttpException(HttpErrorStatusCode errorStatusCode, string responseContent, WebException webException) : base(string.Empty, webException) { this.errorStatusCode = errorStatusCode; this.responseContent = responseContent; }
public HttpException(HttpErrorStatusCode errorStatusCode, Exception exception) : base(string.Empty, exception) { this.errorStatusCode = errorStatusCode; }