I want to use method Html.Action() in my project. I have two projects.
- project 1 - area - HomeController - IndexAction
project 2 - i write a function helper to use in my layout.
public static IHtmlString RenderTest(this HtmlHelper htmlHelper) { string mhs = ""; mhs += htmlHelper.Action("Index", "Home", new { area = "area" }); return new MvcHtmlString(mhs); }
for project 1, I write a route map:
context.MapRoute("area_default",
"Theme/{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = UrlParameter.Optional },
namespaces: new[] { string.Format("{0}.Controllers", this.GetType().Namespace) }
);
How can I use this function to load a controller that is in another assembly?
Html.Action("Index","Home", new { area = "area" });
In addition I have a duplicate controller names in each assembly,
e.g. Namespace1.FooController
and Namespace2.FooController
I don't have a problem with my routes. Also, I can call any controller in different assemblies via URL/routes.
But I cann't use these urls in my HtmlHelper.Action()
.
Actually I want to call an action in controller that is in another assembly and get the view of that action as HtmlString but processed.