I have these route definitions:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "InboxToCompose",
url: "Asistencia/Mensajeria/Componer/{origen}",
defaults: new { controller = "Mensajeria", action = "Componer", area = "Asistencia" }
);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
Route "InboxToCompose" should map to this method:
// GET: /Asistencia/Mensajeria/Componer/origen
public ActionResult Componer(string origen)
{
}
This method is placed in "Mensajeria" controller in "Asistencia" area.
When I call this in view:
Url.Action("Componer", "Mensajeria", new { area = "Asistencia", origen = "Inbox" })
Generated URL is
/Asistencia/Mensajeria/Componer?origen=Inbox
That way, I can see that "origen" parameter is populated with value "Inbox" when the method is called.
However, I want it to be just
/Asistencia/Mensajeria/Componer/Inbox
If I use that URL in browser, the method is called, but with "origen" parameter equal to null.
Any advice on this, please?