コード例 #1
0
        public static PageItem GetPageByFriendlyUrl(string friendlyUrl)
        {
            NESTV1Entities db = new NESTV1Entities();

            PageItem page = null;

            ContentBody contentbody = db.ContentBodies.Single(c => c.SEOUrl == friendlyUrl);

                        page = new PageItem();
                        page.PageId = (int)contentbody.Id;
                        page.ControllerName = "Contribute";
                        page.FriendlyUrl = contentbody.SEOUrl;

                return page;
        }
コード例 #2
0
ファイル: RouteConfig.cs プロジェクト: imor2000/NEST-MASTER
        public static PageItem GetPageByFriendlyUrl(string friendlyUrl)
        {
            NESTV1Entities db = new NESTV1Entities();

            PageItem page = null;

            ContentBody contentbody = db.ContentBodies.Single(c => c.SEOUrl == friendlyUrl);

            page                = new PageItem();
            page.PageId         = (int)contentbody.Id;
            page.ControllerName = "Contribute";
            page.FriendlyUrl    = contentbody.SEOUrl;


            return(page);
        }
コード例 #3
0
ファイル: RouteConfig.cs プロジェクト: imor2000/NEST-MASTER
        protected override IHttpHandler GetHttpHandler(System.Web.Routing.RequestContext requestContext)
        {
            var friendlyUrl = (string)requestContext.RouteData.Values["pageName"];

            PageItem page = null;

            if (!string.IsNullOrEmpty(friendlyUrl))
            {
                page = PageManager.GetPageByFriendlyUrl(friendlyUrl);
            }

            if (page == null)
            {
                page = PageManager.GetPageByFriendlyUrl("default");
            }

            requestContext.RouteData.Values["controller"] = page.ControllerName;
            requestContext.RouteData.Values["action"]     = "index";
            requestContext.RouteData.Values["id"]         = page.PageId;

            return(base.GetHttpHandler(requestContext));
        }