Asp.Net Error: There is no build provider registered for the extension ‘.html’

When you try to map an html file in ASP.net and rewrite the URL to remove .html extension such as the example below

routes.MapPageRoute("myhtml", "myhtml", "~/Resources/demo/myhtml.html");

It throws an error as following

There is no build provider registered for the extension ‘.html’. You can register one in the <compilation><buildProviders> section in machine.config or web.config

The following configuration changes in web.config fixes it.

    <compilation debug="true" targetFramework="4.5" >
      <buildProviders >
        <add extension=".htm" type="System.Web.Compilation.PageBuildProvider"  />
        <add extension=".html" type="System.Web.Compilation.PageBuildProvider"/>
      </buildProviders> 
    </compilation>

 


Leave A Comment

Your email address will not be published.