I will try to explain this the best I can.
I created a CMS that allows you to create Categories and Content Sections. Both have completely different templates, but I want to use the same URL routing mapPageRoute param when routing. Basically, I need it to check if the alias is a category, if not hit the content section router.
Here is my Registered Routes on Global.asax:
void RegisterRoutes(RouteCollection routes)
{
routes.MapPageRoute(
"Home",
string.Empty,
"~/Default.aspx"
);
routes.MapPageRoute(
"Category",
"{*CategoryAlias}",
"~/templates/Category.aspx"
);
routes.MapPageRoute(
"Content",
"{*ContentAlias}",
"~/templates/Content.aspx"
);
}
Currently, Categories work fine, but when I put a content section alias in the URL it hits categories and doesn't skip to the next route to try. The Category.aspx and Content.aspx web forms have completely different views. The code behind is similar but one accesses the Category tables/procedures and the other Content.
If anyone requires more information just ask.
See Question&Answers more detail:os