Click here to Skip to main content
15,905,563 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to achieve ASP.NET MVC3 Routing(controller and Action methods) through XML File?
StianSandberg 12-Jul-12 8:41am    
As i read your question you want to store all your routes in a xml-file?
If so: I think that is a bad idea! Why should you wanna do that? It is possible! Just read xml-file in tha same place as you would create routes (Application_Start) but your routes should be "hard-coded". Why? 1) You can see in your code that your ActionLink is correct or broken. 2) Links should not change often (due to search engines, bookmarkes etc)

in mvc routing you can write following code into globle.asax file
public class MvcApplication : System.Web.HttpApplication
public static void RegisterRoutes(RouteCollection routes)

"Login", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Login", action = "LoginPage", id = UrlParameter.Optional } // Parameter defaults


protected void Application_Start()

Share this answer
These should give you an overview and get started:
Controllers and Routers in ASP.NET MVC 3[^]
Creating a Custom Route Constraint (C#)[^]
MVC: How to route /sitemap.xml to an ActionResult?[^]
MvcSiteMapProvider 3.0.0 for MVC3[^]

            new { controller = "Home", action = "SiteMap" }
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900