CMS
CMS

Reputation: 3757

A few Aliases to map to the same MVC Controller

i have a ASP.NET MVC5 website and i would like to have it load the same page from a few Urls

i should be able to get the the mapsController by all this URLs

/Maps
/Map
/Location
/Locations 

Upvotes: 3

Views: 3914

Answers (1)

Todd Sprang
Todd Sprang

Reputation: 2919

You probably want Attribute Routing: http://blogs.msdn.com/b/webdev/archive/2013/10/17/attribute-routing-in-asp-net-mvc-5.aspx

e.g.

[Route("/Maps")]
[Route("/Map")]
[Route("/Locations")]
[Route("/Location")]
public ActionResult Action () { ... }

Upvotes: 1

Related Questions