我在ASP.NET MVC自定義視圖引擎,因爲升級到RC1實現地區as in this post by Phil Haack不進入覆蓋方法FindView我的自定義視圖引擎,從而打破了應用程序無法找到它們的區域內的任何控制器。據我所知,有很多人在他們的MVC應用程序中使用區域,任何人都知道這個問題的解決方案或者它爲什麼會發生?ASP.NET MVC RC1 - 自定義視圖引擎領域 - FindView覆蓋不點火
以下是我的findview方法供參考。
public override ViewEngineResult FindView(ControllerContext controllerContext, string viewName, string masterName)
{
ViewEngineResult areaResult = null;
if (controllerContext.RouteData.Values.ContainsKey("area"))
{
string areaViewName = FormatViewName(controllerContext, viewName);
areaResult = base.FindView(controllerContext, areaViewName, masterName);
if (areaResult != null && areaResult.View != null)
{
return areaResult;
}
string sharedAreaViewName = FormatSharedViewName(controllerContext, viewName);
areaResult = base.FindView(controllerContext, sharedAreaViewName, masterName);
if (areaResult != null && areaResult.View != null)
{
return areaResult;
}
}
return base.FindView(controllerContext, viewName, masterName);
}
只注意到自己的DLL文件沒有正確地更新和額外的參數沒有被注意到。現在嘗試。 – Odd 2009-01-28 00:18:07