I need to add a http://mysite/categoryname route, so i added
routes.MapRoute(
"Categories",
"{CategoryName}",
new { controller = "News", action = "Category", CategoryName = "" },
new string[] { "MyProj.Controllers" }
);
The problem is that if i add it before
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "News", action = "Index", id = UrlParameter.Optional },
new string[] { "MyProj.Controllers" }
);
Home page goes in error because it enters in Categories route; if i add Categories route in last position it is never entered and http://mysite/category_name gives me 404.
What am i doing wrong?