Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove or replace existing routes in RouteTable

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" }
            );
like image 608
jesperlind Avatar asked Sep 13 '09 14:09

jesperlind


People also ask

What is propagate gateway routes?

Propagation—Route propagation allows a virtual private gateway to automatically propagate routes to the route tables. This means that you don't need to manually enter VPN routes to your route tables. For more information about VPN routing options, see Site-to-Site VPN routing options in the Site-to-Site VPN User Guide.


1 Answers

How do in this?

RouteTable.Routes.Remove(RouteTable.Routes["PostIndex"]);
like image 186
takepara Avatar answered Sep 28 '22 09:09

takepara