Monday, 11 August 2014

How to hit method in MVC area

Hello,
Let's see how to hit/invoke a method in area.

If you are trying to invoke a method in another area with "RedirectToAction" you can write:

return RedirectToAction("Login", "Account", new { Area = ""}); //this will hit you default area. No need to write anything inside inverted comma.

If you have area name then you must have to mention that name inside inverted comma.

return RedirectToAction("Login", "Account", new { Area = "AreaName"}); 

If you want to trigger it from navigation menu item:

item.Add().Text("Area").Url("~/AreaName/ControllerName/MethodName");


No comments:

Post a Comment