« Back to blog

ASP.NET MVC: Return a View from a different Controller

The problem: You want to return a View that's in a different Controller to the one you're currently in. Doing return View("/OtherController/OtherView"); results in an exception, as MVC looks first in the current Controller folder structure, then the Shared folder structure.

The "proper" solution: Copy the View you want into the Shared folder structure and reference it.

Quick & dirty solution: Use return Redirect("OtherController/OtherView"); Hurrah!

Comments (0)

Leave a comment...