2

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?

mko
  • 6,638
  • 12
  • 67
  • 118

0 Answers0