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?
Asked
Active
Viewed 46 times
1 Answers
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
-
and if I want to use not the current controller i should use another version of this method, right? – Sort Embrace Feb 08 '15 at 18:22
-
You should specify the new controller's name in `ActionLink`, right. – Mark Shevchenko Feb 08 '15 at 18:23