Reputation: 187
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.
Upvotes: 2
Views: 475
Reputation: 2786
Have you looked at UrlRewriting.config, I've just read here that you can route using this in 4.7
Upvotes: 0
Reputation: 3107
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 } });
}
}
Upvotes: 1