问题
I am using MapMvcAttributeRoutes to set routes in my MVC application. Now I have a doubt is it possible to access a route name from action Index?
[HttpGet]
[Route("{language}/Home/Index", Name = "Home.Index")]
public ActionResult Index()
{
//access route name Home.Index here?
return View();
}
I wanted to say I tried something, but do not relly know where to start. I did some researching in forums and SO, but did not find any valid answer.
EDIT
In order to fully understand my question here is an example. Each view contains a partial view (header) that generates links for all languages of a current view. Some actions/views use AttributeRoutes and some use default routing from routeconfig. How can I decide when to call RouteUrl and when to call Action?
来源:https://stackoverflow.com/questions/27402530/how-to-get-route-name-from-action