2009-11-09 43 views
1

我期待在這裏Haacks文章 - http://haacked.com/archive/2009/07/31/single-project-areas.aspxAsp.Net MVC - 地區

當我下載的樣本,我得到的Global.ascx以下錯誤

錯誤1「的System.Web .Routing.RouteCollection」 不包含 定義‘MapAreaRoute’,沒有擴展方法 ‘MapAreaRoute’接受型的第一 參數 ‘System.Web.Routing.RouteCollection’ 可以找到(是否缺少 使用指令或裝配 參考?)

我假設我明顯缺少somthing,任何人有什麼想法是什麼?

回答

2

您現在應該使用「AreaRegistration.RegisterAllAreas」在新的實施

本博客文章可能是你有幫助:

代碼

http://suhair.in/Blog/aspnet-areas-in-depth

片段從博客:

protected void Application_Start() 
{ 
    AreaRegistration.RegisterAllAreas(); 1 
    RegisterRoutes(RouteTable.Routes); 
} 

plus ...

public static void RegisterAllAreas() 
{ 
     RegisterAllAreas(null); 
} 

public static void RegisterAllAreas(object state) 
{ 
           2      3 
     RegisterAllAreas(RouteTable.Routes, new BuildManagerWrapper(), state); 
}