views:

28

answers:

1

I have a site that is being converted from classic asp to asp.net webforms. The old version of the website maintained to separate versions of the site, one for the US and one for Canada.

The US version sat at the root of the domain and the Canadian version sat inside a folder named "canada".

The new asp.net version of the application, it was decided that it wasn't necessary to maintain two different versions of the site and it has been merged into one site.

I was wondering however if I could take advantage of URL routing to flip anyone who attempts to access the site via a canadian subfolder they just use the regular site, just that their culture gets set to "en-CA".

In other words the old site was structured like:

http://www.domain.com/ <-- US site
http://www.domain.com/canada <-- Canadian site

The new site will just be at the root domain and the session's culture will be set.

http://www.domain.com/ [Session("Culture") = "en-US"] <-- US site
http://www.domain.com/ [Session("Culture") = "en-CA"] <-- Canadian site

I would like to if someone accesses the site via the canada subfolder, I would like to maintain that canada subfolder in the URL but not actually have a physical copy of the website at that folder.

A: 

You don't need URL routing. Just add a default document there (index.aspx or default.asxp, whatever you have set) and have that page redirect back to http://www.domain.com/ after setting the culture.

[Edit] Ah... maybe I misunderstood. You want the user to have "canada" in the URL for each page they access? In that case, I would probably use an HttpModule... yep, URL routing.

Bryan