/// <summary> /// The handle request. /// </summary> /// <param name="context"> /// The context. /// </param> /// <returns> /// The handle request string /// </returns> public override string HandleRequest(HttpContext context) { var serviceBinder = new WebCoreServiceBinder( ServiceLocator.Current.GetService(typeof(IPageService)) as IPageService, ServiceLocator.Current.GetService(typeof(ISeoDecoratorService)) as ISeoDecoratorService, ServiceLocator.Current.GetService(typeof(ISeoRouteValueService)) as ISeoRouteValueService, ServiceLocator.Current.GetService(typeof(IDomainService)) as IDomainService); return serviceBinder.SiteMapViewModelBind(); }
/// <summary> /// The get http handler. /// </summary> /// <param name="requestContext"> /// The request context. /// </param> /// <returns> /// Ihttp handler /// </returns> protected override IHttpHandler GetHttpHandler(RequestContext requestContext) { string lookFor = (string)requestContext.RouteData.Values["FriendlyUrl"] ?? "home"; UrlRouteViewModel routeViewModel = null; if (!string.IsNullOrEmpty(lookFor)) { if (this.IsValidRequest(lookFor)) { if (!lookFor.Contains("Admin/")) { var serviceBinder = new WebCoreServiceBinder( ServiceLocator.Current.GetService(typeof(IPageService)) as IPageService, ServiceLocator.Current.GetService(typeof(ISeoDecoratorService)) as ISeoDecoratorService, ServiceLocator.Current.GetService(typeof(ISeoRouteValueService)) as ISeoRouteValueService, ServiceLocator.Current.GetService(typeof(IDomainService)) as IDomainService); routeViewModel = serviceBinder.UrlRouteViewModelBind(lookFor); if (routeViewModel != null) { this.MapRequestContext( requestContext, routeViewModel.ControllerName, routeViewModel.ActionName, routeViewModel.PageId.ToString(CultureInfo.InvariantCulture), routeViewModel.RouteValues); } } else { // routeViewModel = new UrlRouteViewModel(); this.MapRequestContext(requestContext, lookFor); } } } if (routeViewModel == null) { if (this.IsValidRequest(lookFor)) { this.MapRequestContext(requestContext, lookFor); } // page = RouteManager.GetByFriendlyUrl("home"); // this.MapRequestContext(requestContext, page.ControllerName, page.ActionName, page.PageId.ToString()); } return base.GetHttpHandler(requestContext); }