设置index.html作为默认页 [英] Set index.html as the default page
问题描述
我有一个空的ASP.NET应用程序,我添加了一个index.html文件。我想设置的index.html作为网站的默认页。
我试图对的index.html右击并设置为起始页面,当我运行它的网址是:的http://本地主机:5134 / index.html的
,但我真正想要的是,当我键入:的http://本地主机:5134
,它应该加载index.html页面
我的路线配置:
公共类RouteConfig
{
公共静态无效的RegisterRoutes(RouteCollection路线)
{
routes.IgnoreRoute({}资源个.axd / {*} PATHINFO); routes.MapRoute(
名称:默认,
网址:{控制器} / {行动} / {ID}
默认:新{控制器=家,行动=索引,ID = UrlParameter.Optional}
);
}
}
我添加到我的路由配置的指令忽略空的路线,并且解决了我的问题。
routes.IgnoreRoute();
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 index.html and set as start page, and when I run it the url is: http://localhost:5134/index.html
but what I really want is that when I type: http://localhost:5134
, it should load the index.html page.
my route config:
public class RouteConfig
{
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 }
);
}
}
I added an instruction to my route config to ignore empty routes and that solved my problem.
routes.IgnoreRoute("");
这篇关于设置index.html作为默认页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!