Use of Route Name in Routes in Asp.Net MVC

The default Asp.Net MVC route is :

routes.MapRoute(
  "Default", // Route name
  "{controller}/{action}/{id}", // URL with parameters
   new { controller = "Home", action = "Index", id = UrlParameter.Optional } 
);

And, If we want to make custom routes then we can do that also, like given below :

routes.MapRoute(
  "Privacy", // Route name
  "privacy",
   new { controller = "Home", action = "Privacy" }
);

So, my question is that what is the purpose of 'Route name' in routes given above or can we have more then one Routes with same 'Route name'.

Answers


It is a shorthand way to reference to the route, by using

@Html.RouteLink("Privacy");

Here an article on ASP.NET about routing, which helped me a lot...

ASP.NET MVC Routing Overview (C#)


Need Your Help

Android - Spacing between CheckBox and text

android checkbox padding

Is there an easy way to add padding between the checkbox in a CheckBox control, and the associated text?

How do I write to a hidden file?

c# file hidden

I am using the TextWriter to try to write to a hidden file, and it is throwing an exception. I can't seem to figure out how to write to a hidden file.