2

I have been benefiting from the advantages of sitemaps for a while now:

  • Extrinsic page relationships. Pages are not responsible for defining their own relationships, instead they are supplied by an external provider. This removes a lot of responsibility from the page when it comes to rendering navigation controls. E.g. "Render my children" instead of "I am a product-list page, so I should render a list of products".
  • Page relationships can be inferred from anywhere. E.g. Sitemap pages become completely automated, as do breadcrumbs and top-level navigation.
  • Generic navigation. Reusable controls can be used to render lists of links to any type of page.

I have, up until now, also been using SiteMapProviders as a routing mechanism. I've been storing a 'routed URL' and a 'handler URL' into each node's Url and Key properties, respectively. I.e. a request comes in, the FindSiteMapNode method is called, and the request is rewritten to the returned node's key.

This works perfectly, but I am aware times are changing and we now have Routing Tables.

After some research, it appears that relationships between pages cannot be inferred from routes. Ergo: "sitemaps cannot be inferred from a routing table". (Am I right?)

Assuming this statement, how do I keep my wonderful sitemaps and keep with the times? Is there a way of having both without masses of code repetition between the two? What specific gains will I receive from Routing Tables over my current approach?

I have looked at: ASP.NET URL Routing with WebForms - Using the SiteMap, which points to http://chriscavanagh.wordpress.com/2009/05/19/asp-net-webform-routing-with-sitemaps/

However, the solution only allows a 1..1 mapping between nodes and routes, respectively. For example, you cannot have many product nodes point to a single route with this method.

Community
  • 1
  • 1
Lawrence Wagerfield
  • 6,471
  • 5
  • 42
  • 84

1 Answers1

3

"This works perfectly, but I am aware times are changing and we now have Routing Tables."

Why change something that works perfectly for you? I recommend you change nothing based on the information you provided. I understand the want and desire to use the new shinny thing, however, you have something that works and fits your current needs.

rick schott
  • 21,012
  • 5
  • 52
  • 81
  • I was thinking this myself. However, I've always adopted the mentality that features like this have been developed for good reason, and from what I can see it's now the standard way to route URLs. If Microsoft invested all this time developing it, and everyone else is doing it, then am I not missing something? – Lawrence Wagerfield Oct 06 '11 at 17:10
  • No, not really, I used "MasterPages" before they existed, but when released I didn't re-write my app. New apps yes. Problems exist before Microsoft's solves them and their solution isn't always what's best for YOUR application. Your architecture is based on what you needed an may not align with another new technology/methodology, so no need to force it into new constraints. – rick schott Oct 06 '11 at 17:19