I have 2 MVC projects. There is a common page that I want to reference directly instead of having to re-write. I’m doing so like this:
public ActionResult test()
{
OldController.Controllers.PatronController temp = new OldController.Controllers.PatronController();
return temp.Index();
}
The problem is, in “OldController” there is some functionality that get set in the OnActionExecuting function. When I call the function like I’m doing above, OnActionExecuting isn’t being called.
How can I share the common page between the two projects (so I can return it OnActionExecuting?
Ideally, you want to keep navigation consistent in each project and still re-use the core functionality.
For that reason, I recommend:
1) creating a 3rd MVC Project with an Action Partial (Partial with Action Method — and Controller).
2) Add a reference for your new MVC project to your 2 primary MVC projects.
3) In each of your primary MVC projects, create Views that render your Action Partial within a View.