Setting the default help page

I have a C # .Net 4.5 Web Api application to which I have added a help page such as the one shown here .

When a developer launches a Web Api application in Visual Studio, I would like for the help page to appear.

I would like to do this by using routing (e.g. changes in WebApiConfig.cs or Global.asax.cs) as opposed to setting in project properties.

In the WebApiConfig.cs file, I tried to add the following:

config.Routes.MapHttpRoute("Default", "api/help");

This did not work. Does anyone know how to make this work? Thank.

+4
source share
1 answer

, , - ( ) RegisterArea HelpPageAreaRegistration.cs HelpPage, . -

    public override void RegisterArea(AreaRegistrationContext context)
    {
        context.MapRoute(
            "HelpPage_Default",
            "Help/{action}/{apiId}",
            new { controller = "Help", action = "Index", apiId = UrlParameter.Optional });
        context.MapRoute(
            "Help Area",
            "",
            new { controller = "Help", action = "Index" });

        HelpPageConfig.Register(GlobalConfiguration.Configuration);
    }
+3

All Articles