Set index.html as the default page

后端 未结 5 707
闹比i
闹比i 2020-12-29 20:07

I have an empty ASP.NET application and I added an index.html file. I want to set the index.html as default page for the site.

I have tried to right click on the ind

5条回答
  •  长发绾君心
    2020-12-29 20:51

    One solution is this one:

     //routes.MapRoute(
     //           name: "Default",
     //           url: "{controller}/{action}/{id}",
     //           defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
     //      );
    

    I mean, comment or delete this code in your MVC project to avoid the default behavior when you make the initial request http://localhost:5134/.

    The index.html must be in the root of your solution.

    Hope this helps! It works for me.

提交回复
热议问题