2 computergameass ComputerGameAss 于 2014.08.02 09:46 提问

MVC4设置起始页为Areas里的某个页面出现问题

我想设置区域Stage里的Controller的Index为起始页,RouteConfig做了这样的修改

routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapRoute(
            name: "Default",
            url: "{controller}/{action}/{id}",
            defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
            namespaces: new string[] { "Products.Areas.Stage.Controllers" }
        ).DataTokens.Add("Areas", "Stage");

为什么跳转的还是原来的起始页呢?

2个回答

ren8179
ren8179   2014.11.22 22:18

routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
namespaces: new string[] { "Products.Areas.Stage.Controllers" }
).DataTokens.Add("area", "Stage");

ren8179
ren8179   2014.11.22 22:18

routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
namespaces: new string[] { "Products.Areas.Stage.Controllers" }
).DataTokens.Add("area", "Stage");

Csdn user default icon
上传中...
上传图片
插入图片