Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

URL Routing with dynamic content for CMS type URL structure

$
0
0

Hello,

Im trying to get URL routing to work for dynamic parent-child hackable URLs, this was working to at least 3rd tier on an Intel based laptop however on an AMD CPU dev machine and Xeon Server the URL routes don't work, I don't expect that the CPU has anything to do with it but the code is the same in all locations but not operating the same (IIS config could vary??)

Previously I had been loading these routes using a database query and populating specific routes i.e. /about-us etc but was wanting to limit the overhead as there are alot of routes and the collection continues to grow

I've added a constraint to help specify that the values must match a valid string, and also added the static component to the path "cms" to help reduce the possibility of conflicts with other paths (there are many feeds, groups, users, profiles etc etc etc). The first few tiers are working on all machines however the  3rd tier and lower values will not work.

Dim contentAConstraint = "^[A-Za-z0-9+/=\-_]{2,}$"
Dim Tier1 = New RouteValueDictionary(New With {.articlename = contentAConstraint})
Dim Tier2 = New RouteValueDictionary(New With {.parent1 = contentAConstraint, .articlename = contentAConstraint})
Dim Tier3 = ...
Dim Tier7 = New RouteValueDictionary(New With {.parent6 = contentAConstraint, .parent5 = contentAConstraint, .parent4 = contentAConstraint, .parent3 = contentAConstraint, .parent2 = contentAConstraint, .parent1 = contentAConstraint, .articlename = contentAConstraint})

routes.MapPageRoute("CMSPage", "cms/{articlename}", "~/Theme_CW/CMS/Page.aspx", False, Nothing, Tier1)
routes.MapPageRoute("CMSPage1", "cms/{parent1}/{articlename}", "~/Theme_CW/CMS/Page.aspx", False, Nothing, Tier2)
routes.MapPageRoute("CMSPage2", "cms/{parent2}/{parent1}/{articlename}", "~/Theme_CW/CMS/Page.aspx", False, Nothing, Tier3)
routes.MapPageRoute("CMSPage3", "cms/{parent3}/{parent2}/{parent1}/{articlename}", "~/Theme_CW/CMS/Page.aspx", False, Nothing, Tier4)
routes.MapPageRoute("CMSPage4", "..
routes.MapPageRoute("CMSPage6", "cms/{parent4}/{parent3}/{parent2}/{parent1}/{articlename}", "~/Theme_CW/CMS/Page.aspx", False, Nothing, Tier7)

Does anyone have any tips to help ensure this works?

Thanks


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>