I don't have a better solution but would try to implement my own ViewEngine.
If your controllers are in modules so that doesn't much standard ASP.NET MVC convention and routes cannot be resolved.
I think that you should implement your own ViewEngine to support it.
For example :
public class ModuleViewEngine: WebFormViewEngine
{
public ModuleViewEngine()
{
ViewLocationFormats = new[]
{
"~/views/{2}/{1}/{0}.aspx",
"~/views/{2}/{1}/{0}.ascx",
"~/views/Shared/{1}/{0}.aspx",
"~/views/Shared/{1}/{0}.ascx",
};
MasterLocationFormats = new[]
{
"~/views/{1}/{0}.master",
"~/views/Shared/{0}.master",
"~/views/{2}/{1}/{0}.master",
"~/views/{2}/Shared/{0}.master",
};
}
public override ViewEngineResult FindPartialView(ControllerContext controllerContext,
string partialViewName, bool useCache)
{
//coede
}
public override ViewEngineResult FindView(
ControllerContext controllerContext,
string viewName, string masterName, bool useCache)
{
//code
}
}
we redefine the ViewLocationFormats and MasterLocationFormats
arrays to accommodate an extra parameter (area). The view locations use standard
string formatting placeholders. The first placeholder, denotes the action
name. The second placeholder,is the controller name and the final placeholder,
is the module name (if specified).
FindPartialView and FindView methods, so we must override these as well.
Because our controllers will now reside in a subfolder of the Controllers folder, we have to register the additional controller namespaces:
ControllerBuilder.Current.DefaultNamespaces.Add("Module.Controllers.something");
This is required because the default ControllerBuilder does not want to reflect over
the entire assembly looking for the controller when matching a route to a specific
controller.