asp.net-mvc – 将index.html设置为默认页面
发布时间:2020-12-16 00:22:11 所属栏目:asp.Net 来源:网络整理
导读:我有一个空的ASP.NET应用程序,我添加了一个index.html文件。我想将index.html设置为网站的默认页面。 我试图右键单击index.html并设置为起始页,当我运行它时,url是:http:// localhost:5134 / index.html但是我真正想要的是当我键入:http: // localho
我有一个空的ASP.NET应用程序,我添加了一个index.html文件。我想将index.html设置为网站的默认页面。
我试图右键单击index.html并设置为起始页,当我运行它时,url是:http:// localhost:5134 / index.html但是我真正想要的是当我键入:http: // localhost:5134,它应该加载index.html页面。 我的路由配置: 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 } ); } } 解决方法
我添加了一条指令给我的路由配置,以忽略空路由,这解决了我的问题。
routes.IgnoreRoute(""); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐
- 如何解决分布式系统中的跨时区问题[实例篇]
- ASp.NET下拉列表和字典
- asp.net – 将persistentCookiesOnPassiveRedire
- asp.net – MembershipUser.IsOnline即使在注销后
- asp.net-mvc-3 – 更改ASP.NET MVC 3文件夹结构
- asp.net-web-api – 在EntitySetController中创建
- asp.net-mvc – ASP.net MVC – FluentValidatio
- asp.net-mvc-4 – MVC4捆绑GZIP和头文件
- entity-framework – ASP.NET Web API中DbContex
- asp.net-mvc – 在两个不同的强类型视图中渲染一
热点阅读