public void HandleError(RequestContext context, int code, HttpException exception) { if (ShouldLogException(code)) { HandleExceptionWithElmah(exception); } Entities.Documents.Web.Webpage webpage = _getErrorPage.GetPage(code); if (webpage != null) { HttpContextBase httpContext = context.HttpContext; httpContext.ClearError(); httpContext.Response.Clear(); httpContext.Response.StatusCode = code; httpContext.Response.TrySkipIisCustomErrors = true; CurrentRequestData.CurrentPage = webpage; System.Web.Mvc.Controller controller = _controllerManager.GetController(context, webpage, httpContext.Request.HttpMethod); IAsyncController asyncController = (controller as IAsyncController); asyncController.BeginExecute(new RequestContext(httpContext, controller.RouteData), asyncController.EndExecute, null); } else { throw exception; } }
public bool Handle(RequestContext context) { if (_getWebpage.Get(context) != null) { return(false); } Entities.Documents.Web.Webpage webpage = _getWebpageByUrlHistory.Get(context); if (webpage == null) { return(false); } context.HttpContext.Response.RedirectPermanent("~/" + webpage.LiveUrlSegment); return(false); }
private static string GetCacheKey(Widget widget, OutputCacheableAttribute attribute) { string cacheKey = "Widget." + widget.Id; if (attribute.PerPage) { Entities.Documents.Web.Webpage page = CurrentRequestData.CurrentPage; if (page != null) { cacheKey += ".Page:" + page.Id; } } if (attribute.PerUser) { cacheKey += ".User:" + CurrentRequestData.UserGuid; } return(cacheKey); }