Share MVC Controller between areas

MVC’s separation is fantastic but some times you have areas that need to use a common controller. This is a question I see often asked online. If you have a common model that is used in different areas like a user you can just inherit from the original:


namespace MainSite.Areas.AreaName{
public class UserController : MainSite.Controllers.UserController
{
}
}

2 Responses to “Share MVC Controller between areas”

  1. Paulo says:

    nice and easy solution, thanks

  2. Gaz says:

    So simple. Thanks 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *