Home > Mobile >  How to set default page in ASP.NET Core MVC and .NET 5?
How to set default page in ASP.NET Core MVC and .NET 5?

Time:11-19

I have created an ASP.NET Core MVC project running on .NET 5. I'm using areas in the project. I have created an area named StaffAug.

How can I set the view Login/Index in StaffAug area as default page?

CodePudding user response:

On Solution Explorer right click your solution (project name) and select properties.

Then click on Web, on Start Action select Spcific Page and the View you want to be your home page.

CodePudding user response:

Try this in your startup.cs file for default page:-

 app.UseEndpoints(endpoints =>
{

    endpoints.MapControllerRoute(
        name: "default",
        pattern: "{area=StaffAug}/{controller=Login}/{action=Index}/{id?}"
    );

});

For that, now your default page is Index view in your Login controller.

  • Related