ASP.NET Route to HTML page


By default, ASP.NET The route in cannot point to an HTML page, such as:

routes.MapPageRoute("route1", "{*placeholder}", "~/index.html");

By default, this code will be blocked by IIS, and an error message will be thrown, similar to the build provider “not registered for extension”. HTML “. After that is to guide you Web.config To register one in the Web.config IncompilationJust add this paragraph below the node:

    <add extension=".html" type="System.Web.Compilation.PageBuildProvider" />