-1

How ASP.NET MVC understand what action method exactly it should use in Html.ActionLink("text","myAction")? Why I dont need to use the name of controller? Also, I know, another version of this method exists (with controller as parameter). What is action binded to?

1 Answers1

0

MVC knows the current controller. More precisely, the MVC core stores route data in the RouteData object:

var controller = HttpContext.Current.Request.RequestContext.RouteData.Values["controller"];
Mark Shevchenko
  • 7,937
  • 1
  • 25
  • 29