Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET Help Pages default home page?

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 the Help Page.

I have a default route set up like this:

public static void RegisterRoutes(RouteCollection routes) {     routes.IgnoreRoute("{resource}.axd/{*pathInfo}");      routes.MapRoute(         name: "Default",         url: "{controller}/{action}/{id}",         defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }         ); } 

Then I have my Help Page Area registration set up like this:

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

When I change RouteConfig's controller to "Help" I get:

The view 'Index' or its master was not found or no view engine supports the searched locations

When I change Help Page route to "{controller}/{action}/{apiId}" my AttributeRoutes stop working.

Is there some easy way to make ASP.NET Help Pages default home page?

like image 276
Gaui Avatar asked Sep 18 '13 17:09

Gaui


People also ask

How do I change the default page in asp net?

Select Admin Tools --> IIS Manager --> Select your website from the list. Click on Default Document on the right hand side and Click Add . Move the entry to the top of the list using the arrows. You are done.

How do I change the default page in ASP NET MVC?

You can set up a default route: routes. MapRoute( "Default", // Route name "", // URL with parameters new { controller = "Home", action = "Index"} // Parameter defaults ); Just change the Controller/Action names to your desired default.

How do I change the start page in .NET core?

For Asp.Net Core 2.2 right click on Project → Properties → Debug and next to Launch Browser checkbox set path to the startup page you want.

Which one from the following will run on top of ASP Net Web API help pages?

NuGet packages (36) A simple Test Client built on top of ASP.NET Web API Help Page.


1 Answers

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.

like image 63
jmsb Avatar answered Nov 23 '22 05:11

jmsb