How do I configure the homepage of my site?

2

I usually create my sites in MVC using the default template that comes in Visual Studio .

Today I created a new project without using a template, and when I tested it, I got an error:

  

A default document is not configured for the requested URL, and directory searching is not enabled on the server.

I want to know how to set up the home page for my site.

Note: I only have HomeController and Index.cshtml

    
asked by anonymous 09.07.2017 / 00:35

1 answer

1

Change the file RouteConfig.cs of the App_Start folder and fill with the following code:

public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                "Default",
                "",
                new { Controller = "Home", action = "Index" }
            );
        }
    }

Source: link

    
09.07.2017 / 01:32