Reputation: 20140
for globalization reason I need to be able to do this:
http://mysite/home
http://mysite/Accueil
what I tried is to inherits home control in my Accueil class:
Public Class AccueilController
Inherits HomeController
End Class
problem is, it's trying to go into the Accueil folder and look for index.aspx there
The view 'Index' or its master could not be found. The following locations were searched:
~/Views/Accueil/Index.aspx
~/Views/Accueil/Index.ascx
~/Views/Shared/Index.aspx
~/Views/Shared/Index.ascx
I would want it to use, so I don't have to duplicate code
~/Views/Home/Index.aspx
what would be the easiest way to do that?
Upvotes: 0
Views: 236
Reputation: 33010
The error message contains your answer. The view engine performs a progressive search for a matching view that moves through a set of configured folders. If you want a shared index view, put the Index.aspx file in ~/Views/Shared/, and that should do the trick.
If you need more flexible view locations, you could look into implementing a custom ViewLocator.
http://blogs.teamb.com/craigstuntz/2008/07/31/37827/
Upvotes: 0
Reputation: 1039418
You are saying that for globalization reasons you need to have both urls render the same view. In this case I would suggest you to use the routing engine and map Accueil
to home
.
routes.MapRoute(
"accueil",
"Accueil/{action}",
new
{
controller = "Home",
action = "Index"
}
);
Upvotes: 2