public IHttpHandler GetHttpHandler(RequestContext requestContext) { int?pageId; var pageName = ResolvePageNameFromRequest(requestContext); if (pageName.Contains("ComingSoon")) { return(CommingSoonPageHandler()); } if (pageName == "/") { return(HomePageHandler()); } if (IsValidPageRequest(pageName, out pageId) && pageId.HasValue) { return(GetDynamicPageHandler(pageId.Value)); } return(RouteHandlerHelper.GetNotFoundHttpHandler()); }
public IHttpHandler GetHttpHandler(RequestContext requestContext) { var scrambledArticleId = 0; if (requestContext.RouteData.Values[QueryStrings.ArticleDetailId] != null) { int.TryParse(requestContext.RouteData.Values[QueryStrings.ArticleDetailId].ToString(), out scrambledArticleId); } var cleanNewsId = UrlUtility.Translate(scrambledArticleId); if (cleanNewsId <= 0) { return(RouteHandlerHelper.GetNotFoundHttpHandler()); } var urlEngine = IoC.Resolve <IUrlEngine <ArticleItem> >(); HttpContext.Current.RewritePath(urlEngine.ResolveUrl(HttpContext.Current.Request.Url.PathAndQuery)); var page = BuildManager.CreateInstanceFromVirtualPath(Redirections.Page_ArticleDetail, typeof(Page)) as Page; return(page); }