2
Afterward of that question I was wondering, is it possible to know on which route map my Action used? Example:
I have two routes.MapRoute()
routes.MapRoute(
"Home",
"Image/{id}",
new
{
controller = "Home",
action = "Image",
id = UrlParameter.Optional
},
new { id = @"\w+" }
);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
And an Action
public ActionResult Image(string id)
{
Debug.WriteLine(id);
return View();
}
Both Map.Route()
will work, only in that case would fall on the first option(because both are correct but the one that comes first is used), but if the Map.Route()
called "Home" did not work, I would not know in which Map.Route()
would be falling when I call Action "Image"
Routetemplate exists?
– Leonardo Bonetti
Oops, I already got the answer, Routetemplate only exists in case the inheritance is in Apicontroller.
– Gabriel Coletta
Sure, I searched and saw that the name is not saved :( but anyway already solves the same way ! + 1
– Leonardo Bonetti