2

I am just trying to move the routes from Asp.net application build in Visual studio to umbraco for the purpose of clean URL in the shop listed by categories.

I am able to achieve this in VS project using the "GLOBAL.ascx" in VS as follows

  void Application_Start(object sender, EventArgs e)
  {
      RegisterRoutes(RouteTable.Routes);
  }

  public static void RegisterRoutes(RouteCollection routes)
  {
          routes.MapPageRoute("",
         "shop/ProductsHome/{type}/{category1}/{category2}",
         "~/shop/ProductsHome.aspx",
            true,
            new RouteValueDictionary { { "type", "product" }, { "category2", null } });
  }

But for some reason this doesn't seem to work in umbraco. I tried HTTP modules, overwriting the umbraco method but nothing seesm to work.

So what is the best way to achieve this. Please helpppppppppppp :(((((

Thanks a ton.

Aneesh
  • 187
  • 1
  • 3
  • 18

2 Answers2

1

I'm not sure which version of Umbraco you're using, in 5 you can do the following

public class Application : MvcApplication
{
    protected override void RegisterCustomMvcRoutes(RouteCollection routes)
    {
        routes.MapPageRoute("",
        "shop/ProductsHome/{type}/{category1}/{category2}",
        "~/shop/ProductsHome.aspx",
        true,
        new RouteValueDictionary { { "type", "product" }, { "category2", null } });
    }
}
Tom Dudfield
  • 3,077
  • 2
  • 25
  • 39
  • Thanks Tom, I am using umbraco 4.7.0. And I tried your suggestion just to check out my luck but it didn't solve the prob :( .... – Aneesh May 07 '12 at 00:26
  • I cant understand what is the prob, it works well in the VS but when I move it doesn't seem to pick it up. Not sure what I am missing in umbraco – Aneesh May 07 '12 at 00:27
0

Have you looked at UrlRewriting.config, I've just read here that you can route using this in 4.7

matt_lethargic
  • 2,706
  • 1
  • 18
  • 33