/// this traditional mvc routing works around a bug in endpoint routing public static IRouteBuilder UseCustomRoutes(this IRouteBuilder routes) { routes.AddCultureBlogRoutesForSimpleContent(new CultureSegmentRouteConstraint()); routes.AddBlogRoutesForSimpleContent(); routes.AddSimpleContentStaticResourceRoutes(); routes.AddCloudscribeFileManagerRoutes(); routes.MapRoute( name: "errorhandler", template: "oops/error/{statusCode?}", defaults: new { controller = "Oops", action = "Error" } ); routes.MapRoute( name: "contact", template: "contact", defaults: new { controller = "Contact", action = "Index" } ); routes.MapRoute( name: "api-sitemap-culture", template: "{culture}/api/sitemap" , defaults: new { controller = "CultureSiteMap", action = "Index" } , constraints: new { culture = new CultureSegmentRouteConstraint() } ); routes.MapRoute( name: "api-rss-culture", template: "{culture}/api/rss" , defaults: new { controller = "CultureRss", action = "Index" } , constraints: new { culture = new CultureSegmentRouteConstraint() } ); routes.MapRoute( name: "api-metaweblog-culture", template: "{culture}/api/metaweblog" , defaults: new { controller = "CultureMetaweblog", action = "Index" } , constraints: new { culture = new CultureSegmentRouteConstraint() } ); routes.MapRoute( name: "sitemap-localized", template: "{culture}/sitemap" , defaults: new { controller = "Page", action = "SiteMap" } , constraints: new { culture = new CultureSegmentRouteConstraint() } ); routes.MapRoute( name: "sitemap", template: "sitemap" , defaults: new { controller = "Page", action = "SiteMap" } ); routes.MapRoute( name: "default-localized", template: "{culture}/{controller}/{action}/{id?}", defaults: new { action = "Index" }, constraints: new { culture = new CultureSegmentRouteConstraint() } ); routes.MapRoute( name: "def", template: "{controller}/{action}" , defaults: new { action = "Index" } ); routes.AddCulturePageRouteForSimpleContent(new CultureSegmentRouteConstraint()); routes.AddDefaultPageRouteForSimpleContent(); return(routes); }
public static IRouteBuilder UseCustomRoutes(this IRouteBuilder routes, bool useFolders) { if (useFolders) { routes.AddCultureBlogRoutesForSimpleContent(new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint(), new CultureSegmentRouteConstraint(true)); routes.AddBlogRoutesForSimpleContent(new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint()); } routes.AddCultureBlogRoutesForSimpleContent(new CultureSegmentRouteConstraint()); routes.AddBlogRoutesForSimpleContent(); routes.AddSimpleContentStaticResourceRoutes(); routes.AddCloudscribeFileManagerRoutes(); if (useFolders) { routes.MapRoute( name: "foldererrorhandler", template: "{sitefolder}/oops/error/{statusCode?}", defaults: new { controller = "Oops", action = "Error" }, constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint() } ); routes.MapRoute( name: "apifoldersitemap-localized", template: "{sitefolder}/{culture}/api/sitemap" , defaults: new { controller = "FolderSiteMap", action = "Index" } , constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint(), culture = new CultureSegmentRouteConstraint(true) } ); routes.MapRoute( name: "apifoldersitemap", template: "{sitefolder}/api/sitemap" , defaults: new { controller = "FolderSiteMap", action = "Index" } , constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint() } ); routes.MapRoute( name: "foldersitemap-localized", template: "{sitefolder}/{culture}/sitemap" , defaults: new { controller = "Page", action = "SiteMap" } , constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint(), culture = new CultureSegmentRouteConstraint(true) } ); routes.MapRoute( name: "foldersitemap", template: "{sitefolder}/sitemap" , defaults: new { controller = "Page", action = "SiteMap" } , constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint() } ); routes.MapRoute( name: "apifoldermetaweblog-localized", template: "{sitefolder}/{culture}/api/metaweblog" , defaults: new { controller = "FolderMetaweblog", action = "Index" } , constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint(), culture = new CultureSegmentRouteConstraint(true) } ); routes.MapRoute( name: "apifoldermetaweblog", template: "{sitefolder}/api/metaweblog" , defaults: new { controller = "FolderMetaweblog", action = "Index" } , constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint() } ); routes.MapRoute( name: "apifolderrss", template: "{sitefolder}/api/rss" , defaults: new { controller = "FolderRss", action = "Index" } , constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint() } ); routes.MapRoute( name: "folderdefault", template: "{sitefolder}/{controller}/{action}/{id?}", defaults: null, constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint() } ); routes.AddCulturePageRouteForSimpleContent(new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint(), new CultureSegmentRouteConstraint(true)); routes.AddDefaultPageRouteForSimpleContent(new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint()); } routes.AddPwaDefaultRoutes(new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint()); routes.MapRoute( name: "errorhandler", template: "oops/error/{statusCode?}", defaults: new { controller = "Oops", action = "Error" } ); routes.MapRoute( name: "api-sitemap-culture", template: "{culture}/api/sitemap" , defaults: new { controller = "CultureSiteMap", action = "Index" } , constraints: new { culture = new CultureSegmentRouteConstraint() } ); routes.MapRoute( name: "api-rss-culture", template: "{culture}/api/rss" , defaults: new { controller = "CultureRss", action = "Index" } , constraints: new { culture = new CultureSegmentRouteConstraint() } ); routes.MapRoute( name: "api-metaweblog-culture", template: "{culture}/api/metaweblog" , defaults: new { controller = "CultureMetaweblog", action = "Index" } , constraints: new { culture = new CultureSegmentRouteConstraint() } ); routes.MapRoute( name: "sitemap-localized", template: "{culture}/sitemap" , defaults: new { controller = "Page", action = "SiteMap" } , constraints: new { culture = new CultureSegmentRouteConstraint() } ); routes.MapRoute( name: "sitemap", template: "sitemap" , defaults: new { controller = "Page", action = "SiteMap" } ); routes.MapRoute( name: "default-localized", template: "{culture}/{controller}/{action}/{id?}", defaults: new { action = "Index" }, constraints: new { culture = new CultureSegmentRouteConstraint() } ); routes.MapRoute( name: "def", template: "{controller}/{action}" , defaults: new { action = "Index" } ); routes.AddCulturePageRouteForSimpleContent(new CultureSegmentRouteConstraint()); routes.AddDefaultPageRouteForSimpleContent(); return(routes); }
public static IRouteBuilder UseCustomRoutes(this IRouteBuilder routes, bool useFolders) { routes.AddCloudscribeFileManagerRoutes(); if (useFolders) { routes.MapRoute( name: "foldererrorhandler", template: "{sitefolder}/oops/error/{statusCode?}", defaults: new { controller = "Oops", action = "Error" }, constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint() } ); routes.MapRoute( name: "apifoldersitemap", template: "{sitefolder}/api/sitemap" , defaults: new { controller = "FolderSiteMap", action = "Index" } , constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint() } ); routes.MapRoute( name: "folderdefault", template: "{sitefolder}/{controller}/{action}/{id?}", defaults: new { controller = "Home", action = "Index" }, constraints: new { sitefolder = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint() }); } routes.MapRoute( name: "stateautosuggest", template: "coredata/stateautosuggestjson", defaults: new { controller = "CoreDaata", action = "StateAutoSuggestJson" } ); routes.MapRoute( name: "errorhandler", template: "oops/error/{statusCode?}", defaults: new { controller = "Oops", action = "Error" } ); //routes.MapRoute( // name: "systlog", // template: "systemlog/{action=Index}" // //, defaults: new { action = "Index" } // ); //routes.MapRoute( // name: "predefault", // template: "{controller}/{action}" // , defaults: new { action = "Index" } // ); routes.MapRoute( name: "default", template: "{controller}/{action}" , defaults: new { controller = "Home", action = "Index" } ); return(routes); }
public static IRouteBuilder UseCustomRoutes( this IRouteBuilder routes, bool useFolders, IConfiguration config) { var useCustomRoutes = config.GetValue <bool>("DevOptions:UseCustomRoutes"); if (useFolders) { routes.AddBlogRoutesForSimpleContent(new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint()); } routes.AddBlogRoutesForSimpleContent(); routes.AddSimpleContentStaticResourceRoutes(); routes.AddCloudscribeFileManagerRoutes(); if (useFolders) { routes.MapRoute( name: "foldererrorhandler", template: "{sitefolder}/oops/error/{statusCode?}", defaults: new { controller = "Oops", action = "Error" }, constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint() } ); routes.MapRoute( name: "apifoldersitemap", template: "{sitefolder}/api/sitemap" , defaults: new { controller = "FolderSiteMap", action = "Index" } , constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint() } ); routes.MapRoute( name: "apifoldermetaweblog", template: "{sitefolder}/api/metaweblog" , defaults: new { controller = "FolderMetaweblog", action = "Index" } , constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint() } ); routes.MapRoute( name: "apifolderrss", template: "{sitefolder}/api/rss" , defaults: new { controller = "FolderRss", action = "Index" } , constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint() } ); if (useCustomRoutes) { routes.MapRoute( name: "folderdefault", template: "{sitefolder}/{controller}/{action}/{id?}" , defaults: new { controller = "Home", action = "Index" } , constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint() } ); routes.AddCustomPageRouteForSimpleContent(new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint(), "docs"); } else { routes.MapRoute( name: "foldersitemap", template: "{sitefolder}/sitemap" , defaults: new { controller = "Page", action = "SiteMap" } , constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint() } ); routes.MapRoute( name: "folderdefault", template: "{sitefolder}/{controller}/{action}/{id?}" , defaults: new { controller = "Home" } , constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint() } ); routes.AddDefaultPageRouteForSimpleContent(new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint()); //routes.AddBlogRoutesForSimpleContent(new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint(),""); } } if (useCustomRoutes) { routes.AddCustomPageRouteForSimpleContent("docs"); } routes.MapRoute( name: "errorhandler", template: "oops/error/{statusCode?}", defaults: new { controller = "Oops", action = "Error" } ); routes.MapRoute( name: "sitemap", template: "sitemap" , defaults: new { controller = "Page", action = "SiteMap" } ); var useHomeIndexAsDefault = config.GetValue <bool>("DevOptions:UseHomeIndexAsDefault"); if (useHomeIndexAsDefault) { routes.MapRoute( name: "default", template: "{controller}/{action}" , defaults: new { controller = "Home", action = "Index" } ); } else { routes.MapRoute( name: "default", template: "{controller}/{action}" //, defaults: new { controller = "Home", action = "Index" } ); } if (!useCustomRoutes) { routes.AddDefaultPageRouteForSimpleContent(); } //routes.AddBlogRoutesForSimpleContent(""); return(routes); }