This is my first post after a long lurker - so be careful :-)
I have a twitter-like site where people can sign up and choose a "friendly URL", so they will have something like this on my site:
mydomain.com/benjones
I also have static pages at the root level, such as:
mydomain.com/about
and of course my homepage:
mydomain.com/
I am new to ASP.NET MVC 2 (actually I just started working today) and I created the following routes to try to achieve the above.
public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.IgnoreRoute("content/{*pathInfo}"); routes.IgnoreRoute("images/{*pathInfo}"); routes.MapRoute("About", "about", new { controller = "Common", action = "About" } ); // User profile sits at root level so check for this before displaying the homepage routes.MapRoute("UserProfile", "{url}", new { controller = "User", action = "Profile", url = "" } ); routes.MapRoute("Home", "", new { controller = "Home", action = "Index", id = "" } ); }
For the most part, this works great, however my homepage does not start! Essentially, when you use the mydomain.com browser, it seems to start a user profile route with an empty {url} parameter, so the home page will never be reached! Any ideas on how I can show the homepage?
source share