views:

596

answers:

1

Hello,

I'd like to implement the asp.net 3.5 url routing functionality to take in links like www.mysite.com/fr/blah/page1.aspx www.mysite.com/en/blah/page1.aspx and redirect them to the same page. I've read through and tried the approach in the following tutorial: http://aspnet.4guysfromrolla.com/articles/051309-1.aspx. However this tutorial doesn't address the issue of generically mapping urls like I want to. For example, they have rules like

routes.Add( "All Categories", new Route("Categories/All", new CategoryRouteHandler()) ); in the global.asax, and then they create a specific CategoryRouteHandler that handles the above url. I want a generic handler that will handle all the urls. In short I want to be able to handle a rule like the following:

routes.Add( "All Languages", new Route("/{language}/*", new LanguageRouteHandler()) );

The problem with this is, that in the LanguageRouteHandler, I'd have to instantiate and return a page object! However, I don't know which page to return. How do I go about doing this?

A: 

this is how I accomplished this:

routes.Add("Lang", new Route("{lang}/{*page}", new LangRouteHandler()));

this handles my situation.