0

I am working on a legacy ASP.NET 1.1 application which doesn't have linkified bread crumb navigation. By this I mean, the bread crumbs exist, but are not hyperlinked.

One of the current requirements is to linkify all the crumbs properly. Each page is a report pulled from the database based on three or four querystring parameters and the datagrid that displays it is built dynamically in runtime.

I don't have too much choice to implement some kind of a sitemap system. Also, it is not easy to just plug in a sitemap system, since there is no easy pattern of the page flow.

So I am just doing a lot of string building based on the existing conditions and injecting links appropriately.

As a result, I am using this snippet a lot:

HttpUtility.UrlDecode(Request.Url.AbsoluteUri);

I must have used it in more than 25 places. This is obviously very unhealthy.

Should I just put in a static helper method in a helper class and call it currentContextURL or something like that? Or is there a better way to accomplish this?

Thank you.

Animesh
  • 4,926
  • 14
  • 68
  • 110

1 Answers1

1

If there is an existing bread crumb links and you are limited with .NET1.1 I would stick with helper. You can implement linked-list-like class and maintain links in there and generate bread crumb from that implementation

paulik
  • 119
  • 2
  • LinkedList sounds like a nice idea, but I am thinking it would not suit as many of the reports are also reachable from other modules and this messes up any possibility of a pattern. Say there is a breadcrumb: `ModuleA -> pg1 -> pg2 -> pg3 -> pg18 -> pg5`. Here `pg18` could be reached from ModuleB and ModuleC with their respective querystring parameters. – Animesh Aug 20 '12 at 21:29
  • I think you should not care about other modules and if they can reach in the linked list as it should be generic enough solution. I'd probably maintain head and tail in the list and make it double linked (parent to child and vice versa) and pass the list to every page (in session or whatever). When you have a page_load, just append to the tail current page name. Using this technique you will have a trail of all pages you navigated through. If user clicked back or link on the bread crumb-> redefine tail to the closest from the tail page with the same name – paulik Aug 21 '12 at 00:14
  • I was a little apprehensive because its been a while since I have worked on LinkedLists, however the way you have described made it easier to understand how I can go about. Thank you. – Animesh Aug 21 '12 at 06:05