开发者

Asp.Net MVC - Areas

开发者 https://www.devze.com 2022-12-11 09:15 出处:网络
I\'m looking at Haacks article here - http://haacked.com开发者_运维技巧/archive/2009/07/31/single-project-areas.aspx

I'm looking at Haacks article here - http://haacked.com开发者_运维技巧/archive/2009/07/31/single-project-areas.aspx

When I download the sample I get the following errors in the Global.ascx

Error 1 'System.Web.Routing.RouteCollection' does not contain a definition for 'MapAreaRoute' and no extension method 'MapAreaRoute' accepting a first argument of type 'System.Web.Routing.RouteCollection' could be found (are you missing a using directive or an assembly reference?)

I assume I am obviously missing somthing, anyone any ideas what?


You should now use "AreaRegistration.RegisterAllAreas" in the new implementation

This blog post may be of use to you:

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

Snippets of code from the blog:

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);
}
0

精彩评论

暂无评论...
验证码 换一张
取 消