asp.net mvc 3 - Mvc maproute multiple page levels -
is there anyway can reduce amount of duplication maproute registration in global.ascx file mulit page levels below.
routes.maproute("article-level1", "{sluglevel1}/article/{id}/{article-title}", new { controller = "article", action = "detail", id = urlparameter.optional }); routes.maproute("article-level2", "{sluglevel1}/{sluglevel2}/article/{id}/{article-title}", new { controller = "article", action = "detail", id = urlparameter.optional }); routes.maproute("article-level3", "{sluglevel1}/{sluglevel2}/{sluglevel3}/article/{id}/{article-title}", new { controller = "article", action = "detail", id = urlparameter.optional }); ... more levels 4 10 ...
please let me know if there better way do.
you can explore "catch-all" route parameters: handling variable number of segments in url pattern.
but need change structure of routes this:
"article/{id}/{article-title}/{*sluglevels}"
Comments
Post a Comment