I have an MVC website that is using .aspx views. I’m finding the view using this method:
public override ViewEngineResult FindView(ControllerContext controllerContext, string viewName, string masterName, bool useCache)
{
string skinName =
this.GetSkinName(controllerContext);
string controllerName =
controllerContext.RouteData.GetRequiredString("controller");
string viewPath =
this.GetPathFromGeneralName(this.ViewLocationFormats, viewName, controllerName, skinName);
string masterPath =
this.GetPathFromGeneralName(this.MasterLocationFormats, viewName, controllerName, skinName);
if (string.IsNullOrEmpty(viewPath))
{
IEnumerable<string> searchedLocations =
this.ViewLocationFormats.Union(this.MasterLocationFormats);
return new ViewEngineResult(searchedLocations);
}
return new ViewEngineResult(this.CreateView(controllerContext, viewPath, masterPath), this);
}
I have a view that is inhering from a master page. Inside it there is a hyper link to an action controller but its view is NOT connectd to the master page (I don’t want it to be).
When it tries to bring up the view of the second action (by clicking the hyperlink), I receive the error message above.
I have other links that are pointing to other content pages, and those work fine, but I can’t link to a stand-alone .aspx page (that is not inheriting from the master page).
Any advice?
I eneded up following the suggestion to create a blank master page.
This link has more explanation:
http://forums.asp.net/p/1880732/5294074.aspx/1?Re+Error+Content+controls+have+to+be+top+level+controls+in+a+content+page+or+a+nested+master+page+that+references+a+master+page