There are a couple of problems with this.
First of all, the default configuration in Web.config will deny any URL with a .
character in it. If you did use routing for this, you would need to reconfigure the web.config.
That said, you specifically mentioned "file". MVC doesn't serve files, it serves resources (either content or streams). Most (if not all) web servers are already setup to serve files (especially html
, css
, and js
files), so unless there is a specific reason you need to, there is no reason to involve ASP.NET/MVC in this at all. Depending on what web server you are using, you should consult the documentation on how to set up index.html
as a default page.
If you decide you want MVC to handle the request rather than the web server, this route configuration won't work because it does not supply the required route values controller
and action
in order to actually route the URL to an MVC controller.
routes.MapRoute(
name: "Root",
url: "index.html",
defaults: new { controller = "Home", action = "Index" }
);
I should also point out that this answer applies to MVC 5 without OWIN. For future reference, it would be helpful if you specify asp.net-mvc-5 or asp.net-core to indicate which version you are referring to.