I've got a custom route in an area as follows:
context.Routes.Add(
"SearchIndex - By Location - USA",
new CountryTypeSpecificRoute(
CountryType.UnitedStates,
"search/{locationType}-in-{query}",
new { controller = "Search", action = "Index", query = UrlParameter.Optional },
new { locationType = new UsaLocationSearchRouteConstraint() })
);
Example URL:
/search/neighborhoods-in-new-york-city
Resolves the action fine. But it can't find the View.
The view 'Index' or its master was not found or no view engine supports the searched locations. The following locations were searched: ~/Views/Search/Index.cshtml ~/Views/Shared/Index.cshtml
The view lives in ~/Areas/Search/Views/Search/Index.cshtml
Why didn't it look there?
If i docontext.MapRoute
instead of context.Routes.Add
, it works. So it seems like it's got to do with the fact i'm using a custom route?
Any ideas?