For much of my web site, I want normal routing to occur the MVC way. However, when the app first launches, I don't want the route to go to /Home/Index.cshtml. I want it to go to simply /Index.html
My current RegisterRoutes looks like this (and does not achieve my goal)
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute("index.html");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
Hope this helps!
Define the routes for all your controllers and remove the default root:
The new default will be index.html.
i don't know if you take this into account, in the root web.config you should set:
you don't need anything else in the RouteConfig.cs if you have a index.cshtml in the root (this file can contain only html code ofcourse).
But if you want to serve (not process) the file only, i mean, index.html for example you need also to set up this file as start Page in the project and thats all, simpliest answer.