ASP.NET Help Pages default home page?

后端 未结 2 992
醉梦人生
醉梦人生 2020-12-24 08:09

I want to go to http://myserver and be able to get Help Pages as the default home page, so the first thing a guest to http://myserver should see is

2条回答
  •  悲&欢浪女
    2020-12-24 08:32

    I accomplished this with the following RouteConfig. I am also using ASP.Net Help Pages to auto-generate my documentation from the inline XML comments:

    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
    
            // By default route the user to the Help area if accessing the base URI.
            routes.MapRoute(
                "Help Area",
                "",
                new { controller = "Help", action = "Index" }
            ).DataTokens = new RouteValueDictionary(new { area = "HelpPage" });
        }
    }
    

    I should also mention that I don't have any other routing in this class since I am using Attribute Routing on API methods individually.

提交回复
热议问题