The. net mvc project setting contains the page in Areas as the default start page, mvcareas
After using vs to create an MVC project, the general default start page is the page corresponding to the --> Controllers --> HomeController --> Index method in the root directory.
Let me first talk about the process of creating Areas:
However, our controller usually creates many files. In this way, we want to create folders to separate these files by business or other classification methods, so we have the concept of region [Areas.
First, create an Areas folder under the root directory, and then create a region under the Areas file, that is, the folder to be classified.
Then VS automatically creates the corresponding folder and file configuration,
Create your own controller under the controllers folder and create the corresponding view page under the views folder.
Here, we have created all of them. How can we set the default startup page and point it to the method in our controller?
Set the controller and action, and add areas as follows:
Routes. mapRoute (name: "Default", url: "{controller}/{action}/{id}", defaults: new {controller = "Account", action = "Index ", id = UrlParameter. optional }). dataTokens. add ("Area", "Account ");