2

我有一个带有生成帮助区域的 ASP.NET-Web-API 项目。我想将主页路由到指向帮助页面。如何才能做到这一点?我已经尝试像下面那样修改区域注册,但它不起作用

    public override void RegisterArea(AreaRegistrationContext context)
    {

        context.MapRoute(
            "HomePage",
            "{controller}/{action}/{id}",
            new { controller = "Help", action = "Index", apiId = UrlParameter.Optional });

        context.MapRoute(
            "HelpPage_Default",
            "Help/{action}/{apiId}",
            new { controller = "Help", action = "Index", apiId = UrlParameter.Optional });

        HelpPageConfig.Register(GlobalConfiguration.Configuration);
    }
4

0 回答 0