views:

173

answers:

1

I got a ASP.NET MVC 2.0 Preview 1 app and started to create some areas which contains their own routes.

I want to have a way to overwrite these routes in the main project. I can of course not add a new route with the same name. I can see the RouteTable.Routes.Remove(RouteBase item) but not sure how to use it.

//Need to remove "PostIndex" before adding it again
routes.MapAreaRoute(
                "OurAreaNameSpace",
                "PostIndex",
                "post/index/{currentPage}",
                new { controller = "Post", action = "Index", currentPage = "" },
                new string[] { "OurAreaNameSpace.Controllers" }
            );
+2  A: 

How do in this?

RouteTable.Routes.Remove(RouteTable.Routes["PostIndex"]);
takepara
It works well. Thanks!
jesperlind