0

I am looking for a solution that will allow me to print generic url for a set of pages. Example: For pages - site.com/About/Contact.aspx, site.com/About/WhoWeAre.aspx, site.com/About/Members.aspx etc., user should see only site.com/About/ in the address bar. Is that something achievable? This site is not SEO friendly and requires users to login before accessing content, also I don't expect site.com/About/ or any internal pages to resolve to any page when typed directly on browser. I am also fine if real url is printed on status bar if the user hovers on the internal links. I don't think URL Rewrite or URL Routing works here. Or may be I am missing something. Using .NET 3.5 and C#. I am tagging sitecore because I am more interested in sitecore based solution where I have different nodes under About tree and I want users to see only upto /About in the address bar, but I think if it can be done in asp.net, I can figure out sitecore part.

xoail
  • 2,978
  • 5
  • 36
  • 70

5 Answers5

0

Absolutely, use the asp.net 4 routing engine.

This will give you exactly what you want: http://weblogs.asp.net/dotnetstories/archive/2011/01/03/routing-in-asp-net-4-0-web-forms.aspx

EDIT: for 3.5 check out: Friendly URLs for ASP.NET

Community
  • 1
  • 1
Adam Tuliper
  • 29,982
  • 4
  • 53
  • 71
  • I dont see how either of those links will help me display a generic url for my url set... – xoail Sep 20 '11 at 16:33
  • Ah I missed a portion of it - you want the entire set not just a single url. sorry - in that case you need to dynamically load whatever page you want as per the url. Check out: http://chriscavanagh.wordpress.com/2008/03/11/aspnet-routing-goodbye-url-rewriting/ – Adam Tuliper Sep 21 '11 at 18:08
0

The only way to solve this, keeping /About in the address bar, would be to create client-side code that switches out the content based on user selection.

nickwesselman
  • 6,845
  • 2
  • 27
  • 46
0

You can do that by loading the About page and then load the content for any child pages using a postback or using ajax calls.

marto
  • 4,170
  • 1
  • 28
  • 39
0

You could also put an iframe on the /About page, and have the navigation links point the iframe to the other pages.

I think you might be able to use the target attribute to target the iframe, or use javascript to change the src of the iframe.

Jason
  • 504
  • 6
  • 11
0

As you are interested in sitecore, I can tell you how we have done custom URL in a recent sitecore build.

You need to have a custom link manager by extending the current LinkProvider.LinkBuilder sitecore class. Then you need to add your custom logic on how you would like the URL by overriding GetItemUrl and BuidlItemUrl to display URL and finally and it in the web.config for sitecore to use your custom link manager.

Naveed Ahmad
  • 445
  • 3
  • 6